lucene-lucene-net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moray McConnachie" <>
Subject RE: [Lucene.Net] search within a list of unique ID's
Date Fri, 27 May 2011 07:45:54 GMT
If the list of IDs could be very long, then the search string could
become horrendously long, and you might also have to look at the maximum
clauses Lucene permits in a query.

If user's search is reasonably restrictive, you might do better running
the user's search then filtering the list of returned results according
to your list of IDs. There are numerous ways of achieving this, I
personally like the custom collector because you can add more
complicated logic later if you want.


Moray McConnachie
Director of IT    +44 1865 261 600
Oxford Analytica

-----Original Message-----
From: digy digy [] 
Sent: 27 May 2011 08:19
Subject: Re: [Lucene.Net] search within a list of unique ID's

Creation of SimplefacetedSearch is slow. Therefore it should only be
created  when a new reader is opened (or reopened).

On Fri, May 27, 2011 at 10:02 AM, Marco Dissel

> Our index contains documents with an unique ID (long number) 
> corresponding to a record in SQL database. I want to start a lucene 
> search within a list of ID's returned from a SQL resultset.
> IDataReader reader = cmd.Execute("select ID from ...") long[] ids = 
> GetID's(reader); string search = Join(ids) /// results in (ID:1 OR 
> ID:2 OR ID:3) search += " AND (" + <searchstring entered by user> + 
> ")"; IndexSearcher searcher = new IndexSearcher(_Reader); Query query 
> = new Lucene.Net.QueryParsers.QueryParser(,,,, search); TopDocs docs =

> searcher.Search(query, 1000000);
> Is this the way to go?
> Thanks


This message and any attachments are confidential and/or privileged. If this has been sent
to you in error, please do not use, retain or disclose them, and contact the sender as soon
as possible.

Oxford Analytica Ltd
Registered in England: No. 1196703
5 Alfred Street, Oxford
United Kingdom, OX1 4EH

View raw message