java - Compass Lucene hits -


i use lucene , compass on , have problem:

          try {         compasshits hits = compassquery.hits();        (compasshit compasshit : hits) {         if (results.size() >= maxresults) {          log.info(this, "number of results exceeded %,d query %s", maxresults, query);          break;         } else {           results.add((t) compasshit.getdata());         }        }     }  

when data geting compasshit.getdata()); , it's 100 hit re-execute search, there possibility change 200 or more?

edit:

from wiki apache org:

"iterating on hits slow 2 reasons. firstly, search() method returns hits object re-executes search internally when need more 100 hits".

and question there opportunity change value "100" "200"? important use compass nor raw lucene.

i looked @ source hits in 2.9.2. it's hard coded. looks it's hard coded

 hits(searcher s, query q, filter f) throws ioexception {     this.weight = q.weight(s);     this.searcher = s;     this.filter = f;     this.ndeletions = countdeletions(s);     getmoredocs(50);     this.lengthatstart = this.length;   } 

if weren't using compass, follow instructions in javadoc hits suggests replacement

instead e. g. topdoccollector , topdocs can used:

  topdoccollector collector = new topdoccollector(hitsperpage);    searcher.search(query, collector);    scoredoc[] hits = collector.topdocs().scoredocs;    (int = 0; < hits.length; i++) {      int docid = hits[i].doc;      document d = searcher.doc(docid);      // current hit      ... 

but since are, unless willing rewrite part of compass, think stuck


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -