tags:

views:

46

answers:

1

Hi,

I have two lucene indexes and i need to search on the two indexes. How can i execute a search in multiple lucene indexes? How can i sort these results?

Thanks, Luiz Costa

+2  A: 

basic code.. just typed it up check out the doc for more details

IndexSearcher[] searchers = new IndexSearcher[2];
searchers[0] = new IndexSearcher(searchDirOne);
searchers[1] = new IndexSearcher(searchDirTwo);

MultiSearcher searcher = new MultiSearcher(searchers);

Query query = QueryParser.Parse("foo","bar" , new StandardAnalyzer());

Hits hits = searcher.Search(query);

MultiSearcher Documentation

Aaron Saunders
thanks Aeron, it's works. But now, i am trying sorting these results.
Luiz Costa