Question

I want to use lucene.net to index records in our database. The records are stored in several different tables and tied together through a records table. Would it be better to index each table separately and tie the search results together in code, or should I tie the records together coming out of the database and place them all in one index?

Any other suggestions would be helpful as well.

Was it helpful?

Solution

If you make a Lucene index that corresponds to each table, then 1) you're going to have to do the work of performing the search against each index and 2) merging the search results in some magical fashion. Lucene is already set up to search documents with multiple fields (see MultiFieldQueryParser), and give you a unified result set.

Even if you decide after making the index that you occasionally only want to search based on the data that came from a single table, you can just use the normal QueryParser to search only the corresponding field of your documents.

OTHER TIPS

Lucene isn't tied to database tables, you select the information you want in a Lucene document. I would likely be better to let Lucene handle the merging and ranking of results rather than doing it yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top