Just some thoughts - no answers.
As the analyser for each index is different then the query produced by the
query parser will be different.
It may be that you will have to create a query per index then run the
multiple queries on each index separately. You would then need to somehow
combine the results. It may be that you can create a specialised
HitCollector that will merge the results for you.
Regards
Paul I.
Olivier Jaquemet <[EMAIL PROTECTED]> wrote on 14/09/2005
13:29:27:
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]