FAQ
Hi :)

I know it is possible to create a query on different fields with
different analyzers with PerFieldAnalyzer class but is it possible to
also include fields which are not analyzed ?

I want some fields not to be tokenized (an exact reference of an article
for example) and others to be tokenized (like the description of the
article). I would like to be able to search for a word in both fields
with one single query.

Thank you :)




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

Search Discussions

  • Erick Erickson at Jun 20, 2011 at 2:44 pm
    See PerFieldAnalyzerWrapper, then form your query like
    field1:word1 OR field2:word1

    Best
    Erick
    On Mon, Jun 20, 2011 at 10:40 AM, G.Long wrote:
    Hi :)

    I know it is possible to create a query on different fields with different
    analyzers with PerFieldAnalyzer class but is it possible to also include
    fields which are not analyzed ?

    I want some fields not to be tokenized (an exact reference of an article for
    example) and others to be tokenized (like the description of the article). I
    would like to be able to search for a word in both fields with one single
    query.

    Thank you :)




    ---------------------------------------------------------------------
    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
  • G.Long at Jun 20, 2011 at 3:12 pm
    Ok, I'll try this.

    But will it work if one of the fields has no analyzers assigned ?

    For example field1 is associated with a keyword analyzer, field2 with a
    standardAnalyzer and field3 has no analyzer because it was indexed as
    Field.Index.NOT_ANALYZED. Is there something to specify in the
    constructor of the PerFieldAnalyzerWrapper for the field3 ?

    Regards,
    Gary

    Le 20/06/2011 16:43, Erick Erickson a écrit :
    See PerFieldAnalyzerWrapper, then form your query like
    field1:word1 OR field2:word1

    Best
    Erick

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Raf at Jun 20, 2011 at 5:28 pm
    You can simply use a KeywordAnalyzer for your NOT_ANALYZED fields.
    This analyzer, in fact, does not modify your input.

    Regards,
    *Raf*
    On Mon, Jun 20, 2011 at 5:12 PM, G.Long wrote:

    Ok, I'll try this.

    But will it work if one of the fields has no analyzers assigned ?

    For example field1 is associated with a keyword analyzer, field2 with a
    standardAnalyzer and field3 has no analyzer because it was indexed as
    Field.Index.NOT_ANALYZED. Is there something to specify in the constructor
    of the PerFieldAnalyzerWrapper for the field3 ?

    Regards,
    Gary

    Le 20/06/2011 16:43, Erick Erickson a écrit :

    See PerFieldAnalyzerWrapper, then form your query like
    field1:word1 OR field2:word1

    Best
    Erick
    ------------------------------**------------------------------**---------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.**apache.org<java-user-unsubscribe@lucene.apache.org>
    For additional commands, e-mail: java-user-help@lucene.apache.**org<java-user-help@lucene.apache.org>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJun 20, '11 at 2:40p
activeJun 20, '11 at 5:28p
posts4
users3
websitelucene.apache.org

3 users in discussion

G.Long: 2 posts Raf: 1 post Erick Erickson: 1 post

People

Translate

site design / logo © 2022 Grokbase