Hello, I am using Lucene 4.0.0, trying to put together a CustomQuery and a Collector, and have a problem with the calculation of scores.
My context is as follows. I have a big BooleanQuery which works fine, but I also want to calculate some statistics during the search (i.e. perform aggregation operations). To do so, I have tried to pass a custom Collector to the searcher, in charge of retrieving data from the matched documents (using FieldCache), and performing the appropriate calculations. The whole thing works fine, the calculations seem to be done properly (I have yet to test more accurately) : --- IndexSearcher searcher = new IndexSearcher(reader); searcher.search(query, collector); --- Now, my Collector also collects a sample of the matched documents, in order to display them. These documents are collected one after the other, at each call of the collect() method, until the sample is complete. What I would like is to have the documents sorted by their score, and I also would like to calculate the score myself. In other words, I want to make a sample of the "best" documents, while still calculating statistics for all matched documents. I am confused about how to do that. I have created a CustomQuery, wrapping the source BooleanQuery, using a CustomScoreProvider. However, when I execute the search upon this query, with the collector, my log shows that the CustomScoreProvider is properly instantiated, but that the customScore() method is never called. Interestingly, if I execute the custom query without the collector, retrieving some TopDocs object, then the customScore() is called. What can I do? So far, my collector does not make use of the Scorer passed to the setScorer() method - should I use it? I have tried the simple scorer.score() call in the collector setScorer() method, resulting in the customScore() method being called, but with no docID. Thank you in advance for your insight. Kind regards, Yep. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org