lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Jaquemet <olivier.jaque...@jalios.com>
Subject Re: MultiSearcher... Multiple Analyzer
Date Wed, 14 Sep 2005 12:29:27 GMT
Thank you for your answer Grant.
I already have a similar architecture than yours, allowing me do 
retrieve the analyzer used for a specific index.
But how does it solve the problem of doing one search on multiple 
indices using multiple analyzer ?

I'm not sure I was enough clear when asking my question.

Currently here is what can be done using the MultiSearcher;
  // let's pretend for the example that we deal with two languages index,
  // Directory indexDirEn, Directory indexDirEn;
  Searcher[] searchers = { new IndexSearcher(indexDirEN), new 
IndexSearcher(indexDirFR) };
  MultiSearcher searcher = new MultiSearcher(searchers);
  Query query = QueryParser.parse(queryStr, "defaultfield", theAnalyzer));
  Hits hits = searcher.search(query);
As you can see, we user the same analyzer "theAnalyzer" for all indices, 
this is of course a bad idea because each of the indices have been fill 
using a dedicated analyzer.

What I'd like to do is more something like this:
  Searcher[] searchers = { new IndexSearcher(indexDirEN), new 
IndexSearcher(indexDirFR) };
  Analyzer[] analyzers = { enAnalyzer, frAnalyzer };
  MultiSearcher searcher = new MultiSearcher(searchers);
  Query query = QueryParser.parse(queryStr, "defaultfield", analyzers));
  Hits hits = searcher.search(query);
(I undesrstand this code makes no sense, it's just to show that I want 
to specify as many analyzer as there are indices).

Any suggestions?

Olivier

Grant Ingersoll wrote:

>I store an Index (not part of Lucene) object w/ the Lucene index that
>contains a bunch of metadata about the index, one being the name of the
>Analyzer used (other things include the language of the Index, which
>field contains a unique document identifier (not the internal Lucene
>id), etc.  Then at search time, I just get an new instance of that
>Analyzer and pass it to the query parser and do my searches.  Then you
>just need a mechanism for managing your Index, which is pretty
>straightforward (hash by location or something like that)
>




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message