You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Daniel Rosher <ro...@gmail.com> on 2013/09/03 17:41:41 UTC

Dynamic Query Analyzer

Hi,

We have a need to specify a different query analyzer depending on input
parameters dynamically.

We need this so that we can use different stopword lists at query time.

Would any one know how I might be able to achieve this in solr?

I'm aware of the solution to specify different field types, each with a
different query analyzer, but I'd like not to have to index the field
multiple times.

Many thanks
Dab

Re: Dynamic Query Analyzer

Posted by Roman Chyla <ro...@gmail.com>.
You don't need to index fields several times, you can index is just into
one field, and use the different query analyzers just to build the query.
We're doing this for authors, for example - if query language says
"=author:einstein", the query parser knows this field should be analyzed
differently (that is the part of your application logic, of your query
language semantics - so it can vary).

The parser will change the 'author' to 'nosynonym_author', this means
'nosynonym_author' analyzer to be used for analysis phase, and after the
query has been prepared, we 'simply' change the query field from
'nosynonym_author' into 'author'. Seems complex, but it is actually easy.
But it depends on what a query parser you can/want to use. I use this:
https://issues.apache.org/jira/browse/LUCENE-5014

roman




On Tue, Sep 3, 2013 at 11:41 AM, Daniel Rosher <ro...@gmail.com> wrote:

> Hi,
>
> We have a need to specify a different query analyzer depending on input
> parameters dynamically.
>
> We need this so that we can use different stopword lists at query time.
>
> Would any one know how I might be able to achieve this in solr?
>
> I'm aware of the solution to specify different field types, each with a
> different query analyzer, but I'd like not to have to index the field
> multiple times.
>
> Many thanks
> Dab
>

Re: Dynamic Query Analyzer

Posted by Jack Krupansky <ja...@basetechnology.com>.
Sounds like it would be better for you to preprocess the query in your 
application layer. Your requirements seem too open-ended to "wire" into 
Solr.

But, to be sure, please elaborate exactly what sort of variations you need 
in query analysis.

-- Jack Krupansky

-----Original Message----- 
From: Daniel Rosher
Sent: Tuesday, September 03, 2013 11:41 AM
To: solr-user
Subject: Dynamic Query Analyzer

Hi,

We have a need to specify a different query analyzer depending on input
parameters dynamically.

We need this so that we can use different stopword lists at query time.

Would any one know how I might be able to achieve this in solr?

I'm aware of the solution to specify different field types, each with a
different query analyzer, but I'd like not to have to index the field
multiple times.

Many thanks
Dab