mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Special: Broadcast events to one specific tab, not all tabs with same name
This commit is contained in:
@@ -19,6 +19,7 @@ public class Gflucene_index_data {
|
||||
public final Gflucene_analyzer_data analyzer_data;
|
||||
public final String index_dir;
|
||||
public final float max_merged_segments = 1500; // "limits" maximum file size
|
||||
public final boolean positional_enabled = false;
|
||||
public Gflucene_index_data(Gflucene_analyzer_data analyzer_data, String index_dir) {
|
||||
this.analyzer_data = analyzer_data;
|
||||
this.index_dir = index_dir;
|
||||
|
||||
@@ -67,10 +67,10 @@ public class Gflucene_indexer_mgr {
|
||||
|
||||
// create field for body
|
||||
this.body_fld_type = new FieldType();
|
||||
body_fld_type.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
|
||||
IndexOptions index_options = idx_data.positional_enabled ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS : IndexOptions.DOCS_AND_FREQS;
|
||||
body_fld_type.setIndexOptions(index_options);
|
||||
body_fld_type.setTokenized(true);
|
||||
body_fld_type.setStored(false);
|
||||
// body_fld.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
|
||||
// body_fld.setStoreTermVectors(true);
|
||||
// body_fld.setStoreTermVectorOffsets(true);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Gflucene_searcher_mgr {
|
||||
throw Err_.new_exc(e, "lucene_index", "failed to init searcher", "dir", idx_data.index_dir);
|
||||
}
|
||||
}
|
||||
public void Exec(List_adp list, Gflucene_searcher_qry data) {
|
||||
public void Exec(Ordered_hash list, Gflucene_searcher_qry data) {
|
||||
try {
|
||||
IndexReader reader = DirectoryReader.open(index);
|
||||
IndexSearcher searcher = new IndexSearcher(reader);
|
||||
@@ -79,10 +79,14 @@ public class Gflucene_searcher_mgr {
|
||||
int docId = hits[i].doc;
|
||||
Document d = searcher.doc(docId);
|
||||
// Gflucene_doc_data doc = new Gflucene_doc_data(Integer.parseInt(d.get("page_id")), Integer.parseInt(d.get("page_score")), d.get("title"), "");
|
||||
Gflucene_doc_data doc = new Gflucene_doc_data(Integer.parseInt(d.get("page_id")), 0, d.get("title"), "");
|
||||
doc.lucene_score = hits[i].score;
|
||||
String docTitle = d.get("title");
|
||||
Gflucene_doc_data doc = (Gflucene_doc_data)list.Get_by(docTitle);
|
||||
if (doc == null) {
|
||||
doc = new Gflucene_doc_data(Integer.parseInt(d.get("page_id")), 0, docTitle, "");
|
||||
doc.lucene_score = hits[i].score;
|
||||
list.Add(docTitle, doc);
|
||||
}
|
||||
// Tfds.Write(doc.lucene_score, doc.title);
|
||||
list.Add(doc);
|
||||
}
|
||||
|
||||
reader.close();
|
||||
|
||||
Reference in New Issue
Block a user