lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hu Jing <huj....@gmail.com>
Subject how to search a certain number of document without travelling all related documents
Date Tue, 12 Mar 2013 11:42:20 GMT
I want to achieve a non-sort query method.  Use custom collector, it can
collect all documents what i need.

in this situation, I don't care the document query score. I just make sure
the returned docs are revelant with query.


But the index lib is very big. it has about ten million documents. And a
query result is very big too, it maybe have 1 million related documents.

so I want to get results constantly and get 1000 docs once, but don't
travel all related docs. this method will return results as soon as
possible and ease the burden on the system.

using indexsearcher.search(Query query, int n) function can get the certing
number the result.

but when I view the lucene search source code, i find it will iterate all
related docments(iterating 1 million docs will be very time consuming)

the code in the below:

Scorer.java
======================
public void score(Collector collector) throws IOException {
 collector.setScorer(this);
 int doc;
 while ((doc = nextDoc()) != NO_MORE_DOCS) {
 collector.collect(doc);
}
}

so my question is how to achieve a non-sort query method, this method can
get result constantly and  don't travel all unnecessary doc.

Does Lucene supply some strategies to implement this?

Thanks for any reply.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message