lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul.Illingwo...@saaconsultants.com
Subject Re: MultiSearcher... Multiple Analyzer
Date Wed, 14 Sep 2005 14:45:24 GMT





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 <olivier.jaquemet@jalios.com> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
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