A forgot to ask a follow up question around getting all ids from a search query, isn’t there any method where I can say something like:
Hits hits= searcher.Search(..... Int[] keys= Hits.GetAllIds() Instead of having to go through the enumerator? Niclas -----Original Message----- From: Niclas Rothman [mailto:[email protected]] Sent: 15 December 2009 09:42 To: [email protected] Subject: RE: Get all document ids from a search. Hi there and many thanks for your reply, really appreciated. Yes, the solution is a little bit far out but unfortunately I can't really change the requirements. The thing is that the customer requires the search results to be ordered by its conversion rate, a number telling how good these objects Are performing from a sales perspective. I started out to have everything in the database but soon I realized that it Is quite naïve to think that I could write something just in the near of Lucene, so I have ended with a solution were data resides in two different places, Lucene and in the database... The result set I expect from various queries will be at top 200 objects which for me which are new to Lucene having hard to validate if it is many or few, I guess this is a very little result set, correct? Is there any way in Lucene to write something similar to an IComparer interface, where I could write my custom sorting rules? Regards Niclas -----Original Message----- From: Ted Dunning [mailto:[email protected]] Sent: 15 December 2009 00:09 To: [email protected] Subject: Re: Get all document ids from a search. On Mon, Dec 14, 2009 at 3:00 PM, Niclas Rothman <[email protected]> wrote: > How can I get from a search all document ids? > Can this be done with ok performance? > They should be in the documents. If you have lots of them, no, you won't be able to get them all with decent performance. > > I have been wondering if could do the sorting in lucene but I don't feel > comfortable at all because of lacking information / documentation. > Also, the sorting should preferable be don Just in time, that is, the > underlying data for sorting changes constantly and I cant reindex as soon as > sorting data changes. > You have a problem. You might be able to use real-time updates in Lucene to get something close to what you want. But it is probably better to re-examine the requirements. Any idea / suggestions? > Can you bend some of the requirements? Is it really necessary to sort on things that are really changing all the time? Do you have a relatively small number of objects in your result sets? How long would it take to retrieve the sorting info from a few hundred or even a few thousand items?
