1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Mass_parse: Embed score in full-text search index

This commit is contained in:
gnosygnu
2017-04-22 09:40:15 -04:00
parent 53c3400366
commit eaa83db644
7 changed files with 16 additions and 7 deletions

View File

@@ -64,14 +64,12 @@ public class Gflucene_searcher_mgr {
IndexSearcher searcher = new IndexSearcher(reader);
// Query query = new QueryParser("body", analyzer).parse(data.query);
Query multi_query = MultiFieldQueryParser.parse(data.query, new String[] {"body"}, new BooleanClause.Occur []{BooleanClause.Occur.SHOULD}, analyzer);
// Query body_query = new QueryParser("body", analyzer).parse(data.query);
// Query title_query = new QueryParser("title", analyzer).parse(data.query);
// creates query that boosts by page_score; not sure if this is needed, but 1st release of fts uses this
Query multi_query = MultiFieldQueryParser.parse(data.query, new String[] {"body"}, new BooleanClause.Occur []{BooleanClause.Occur.SHOULD}, analyzer);
FunctionQuery boost_query = new FunctionQuery(new LongFieldSource("page_score"));
CustomScoreQuery query = new CustomScoreQuery(multi_query, boost_query);
// TopDocs docs = searcher.search(query, reader.maxDoc());
TopDocs docs = searcher.search(query, data.match_max);
ScoreDoc[] hits = docs.scoreDocs;