From: Mohammad i. <m.i...@gm...> - 2012-03-22 06:51:01
|
Hi, I have a problem in searching multiple indexes. We have two options to do this *1- using MuliSearcher* with this option i always get hits from the second index only however i use MultiSearcher::subSearcher(int32_tn) to be sure that the hit is from the index number (0) here is a code sample Searchable*s[3]={newIndexSearcher(firstIndexPath),newIndexSearcher(secondIndexPath()),NULL}; MultiSearcher * searcher = new MultiSearcher(s); Hits * hits = searcher->search(query); for(int i = 0; i < hits->length(); i++){ cout<<searcher->subSearcher(i); } The Result is 0 0 1 1 So it means that i have hits from each index, but when i try to get the docs i always found that the docs came from the second index! *2- Using MultiReader* with this option i couldn't make the app to compile. here is a code sample lucene::util::Array<IndexReader*>*r=newlucene::util::Array<IndexReader*>(3); r[0] = IndexReader::open(firstIndexPath); r[1] = IndexReader::open(secondIndexPath); r[2] = NULL; MultiReader * multiReader = new MultiReader(r); m_searcher=newIndexSearcher(multiReader); I always get an error error: invalid conversion from 'lucene::index::IndexReader*' to 'unsigned int' How can I search multiple Indexes? Sincerely, -- Mohamed Ismail |