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

Reply via email to