Thanks Michael - I bought the new book from Manning and learned about TopDocs and switched to

topDocs = ixs.Search(bq, null, PAGESIZE);

to retrieve a set number of documents (PAGESIZE is 250). This works beautifully - same ordering as the previous sort, but less than 1second for queries that were around 20 seconds. (An interesting side question, is why does there appear to be no TopDocs IndexSearcher.Search( query, Int) implementation that is mentioned as being in the Java version in the Manning book?)

However, the new question is, is it possible to automatically filter these results to say return the top 250 results with field="id" having unique results only. Eg - each material in the index has a unique id field value but may be in the index under many different documents with different names. I just want to return the top 250 unique results disregarding subsequent repeats of the material under different names that might match. It's very hard to see a way to use the TopDocs implementation to do this as requires visiting an arbitrary records to get 250 unique.

Karl

On 29/04/2009 4:35 PM, Michael Mitiaguin wrote:
I guess, in C# code without sorting you will have a similar time to Luke .
Just sort your memory collection after Lucene search with your preferable
sorting algorithm or just use ordered  collection.  Slowness of built-in
Lucene sorting  is known problem.

On Wed, Apr 29, 2009 at 4:06 PM, Karl Geppert<[email protected]>  wrote:

What might cause the following query to take about 20 seconds to run in c#
code, but only 47ms to run in luke-all 0.9.2 on the same query and same
index (but without the sort)?

Is there any easy thing I can do to bring it to this speed?

                      hits = ixs.Search( bq, new Sort( new SortField[] { new
SortField( "name" ), SortField.FIELD_SCORE }) );

where bq is +name:DODECYLANILINE -type:U





_____________________________________________________________________

This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com
________________________________________________________________________

Reply via email to