One of the issues I have run across lately is running a query across multiple Lucene.NET indexes. Although a rather simple exercise, something I had trouble finding help on none the less.
I'm going to assume you have already performed a search across a single index and just start from where you would create load multiple index and search.
To Start out we would need to create a Searchable object. In this exercise we will just assume that there are two indexs located in c:\index1 and c:\index2.
As mentioned before first we create an array of the searchable obj.
Lucene.Net.Search.Searchable[] _searchables = new Searchable[2];
Next we have to create two index searcher and assign them two the searchables object
_searchables[0] = new IndexSearcher(@"c:\index1");
_searchables[1] = new IndexSearcher(@"c:\index2");
After that we can create a MultSearcher using the array of searchables for the constructor.
Lucene.Net.Search.MultiSearcher searcher = new MultiSearcher(_searchables);
We can now create our 'Hits' object and do our search.
Lucene.Net.Search.Hits hits = searcher.Search(compoundQuery);
After this it's just a matter or building your results.
Happy Coding.
4068218c-f3c1-4011-b59c-86f221460877|1|3.0