FAQ
Hi,
I've just started using the ComplexPhraseQueryParser and it works great with one field but is there a way for it to work with multiple fields? For example, right now the query:
job_title: "sales man*" AND NOT contact_name: "Chris Salem"
throws this exception
Caused by: org.apache.lucene.queryParser.ParseException: Cannot have clause for field "job_title" nested in phrase for field "contact_name"
What is the best way to work around this?
Sincerely,
Chris Salem

Search Discussions

  • Ahmet Arslan at May 2, 2011 at 10:43 am
    Hi,
    I've just started using the ComplexPhraseQueryParser and it works great with one field but is there a way for it to work with multiple fields?  For example, right now the query:
    job_title: "sales man*" AND NOT contact_name: "Chris Salem"
    throws this exception
    Caused by: org.apache.lucene.queryParser.ParseException: Cannot have clause for field "job_title" nested in phrase for field "contact_name"
    What is the best way to work around this?

    There is "Lucene-1486 non default field.patch" for that but it requires :

    "Fixing this would require changing the package name of
    ComplexPhraseQueryParser or changing the visibility of "field" in the
    QueryParser base class to "protected".
    Anyone have any strong feelings about which of these is the most acceptable?"

    https://issues.apache.org/jira/browse/LUCENE-1486


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chris Salem at May 3, 2011 at 1:20 pm
    That seems to work. Thank you!
    Sincerely,
    Chris Salem
    Development Team
    Main Sequence Technologies, Inc.
    PCRecruiter.net - PCRecruiter Support
    chris@mainsequence.net
    P: 440.946.5214 ext 5458
    F: 440.856.0312

    This email and any files transmitted with it may contain confidential information intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Main Sequence Technologies, Inc. 4420 Sherwin Rd. Willoughby OH 44094 www.pcrecruiter.net




    ----- Original Message -----
    To: "java-user@lucene.apache.org" <java-user@lucene.apache.org>, Chris Salem <chris@mainsequence.net>
    From: Ahmet Arslan <iorixxx@yahoo.com>
    Sent: 5/2/2011 6:42:37 AM
    Subject: Re: ComplexPhraseQueryParser with multiple fields




    Hi,
    I've just started using the ComplexPhraseQueryParser and it works great with one field but is there a way for it to work with multiple fields? For example, right now the query:
    job_title: "sales man*" AND NOT contact_name: "Chris Salem"
    throws this exception
    Caused by: org.apache.lucene.queryParser.ParseException: Cannot have clause for field "job_title" nested in phrase for field "contact_name"
    What is the best way to work around this?

    There is "Lucene-1486 non default field.patch" for that but it requires :

    "Fixing this would require changing the package name of
    ComplexPhraseQueryParser or changing the visibility of "field" in the
    QueryParser base class to "protected".
    Anyone have any strong feelings about which of these is the most acceptable?"

    https://issues.apache.org/jira/browse/LUCENE-1486


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

    (The following links were included with this email:)
    http://www.pcrecruiter.net/

    http://www.pcrecruiter.net/support.htm

    mailto:chris@mainsequence.net



    (The following links were included with this email:)
    http://www.pcrecruiter.net/

    http://www.pcrecruiter.net/support.htm

    mailto:chris@mainsequence.net
  • Lichman at Jun 21, 2011 at 4:05 pm
    Say,
    Which of the solutions did you find to work better?
    Can you please say which package should I change it to if I choose to do it
    that way?

    Thanks,
    Moshe Lichman.


    --
    View this message in context: http://lucene.472066.n3.nabble.com/ComplexPhraseQueryParser-with-multiple-fields-tp2879290p3090213.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ahmet Arslan at Jun 22, 2011 at 11:15 am

    Which of the solutions did you find to work better?
    Can you please say which package should I change it to if I
    choose to do it
    that way?
    I think changing package name of ComplexQueryParser is easier. This way you can use existing patch directly.

    Plus, do you mind voting https://issues.apache.org/jira/browse/LUCENE-1486? This will require creating a jira account if you don't already have one.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Lichman at Jun 23, 2011 at 8:28 am
    Which patch are you referring to? The last one?
    And sure... I'll do the voting thing.

    --
    View this message in context: http://lucene.472066.n3.nabble.com/ComplexPhraseQueryParser-with-multiple-fields-tp2879290p3099032.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Lichman at Jun 23, 2011 at 10:44 am
    By the way - I'm using the ComplexPhraseQueryParser that I've downloaded
    from:

    https://issues.apache.org/jira/browse/SOLR-1604

    And I've tried to use packages:

    - org.apache.lucene.search
    - org.apache.lucene.queryParser

    Both, when compiled and added to the SOLR lib dir, caused the exception.

    Any ideas?


    --
    View this message in context: http://lucene.472066.n3.nabble.com/ComplexPhraseQueryParser-with-multiple-fields-tp2879290p3099397.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ahmet Arslan at Jun 23, 2011 at 10:51 am

    By the way - I'm using the
    ComplexPhraseQueryParser that I've downloaded
    from:

    https://issues.apache.org/jira/browse/SOLR-1604

    And I've tried to use packages:

    - org.apache.lucene.search
    - org.apache.lucene.queryParser

    Both, when compiled and added to the SOLR lib dir, caused
    the exception.
    That's a different story then. You don't need to change anything. You can use it as plugin. However you need to embed the jar file into solr.war. Please follow the instructions described here :

    https://issues.apache.org/jira/browse/SOLR-1604?focusedCommentId=12859048&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12859048

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Lichman at Jun 23, 2011 at 11:25 am
    Thanks! Now it works.

    But now there's another issue.
    I'm using SOLR and Lucene 3.1.0 and when sending a query "Wildcard* phrase*"
    it works as expected - but, when sending the query "wildcard*" (Only one
    word withing the phrase) I'm getting another exception:

    HTTP ERROR: 500
    Unknown query type "org.apache.lucene.search.PrefixQuery" found in phrase
    query string "touch*"
    java.lang.IllegalArgumentException: Unknown query type
    "org.apache.lucene.search.PrefixQuery" found in phrase query string "touch*"

    Any ideas?

    --
    View this message in context: http://lucene.472066.n3.nabble.com/ComplexPhraseQueryParser-with-multiple-fields-tp2879290p3099495.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ahmet Arslan at Jun 23, 2011 at 1:06 pm

    But now there's another issue.
    I'm using SOLR and Lucene 3.1.0 and when sending a query
    "Wildcard* phrase*"
    it works as expected - but, when sending the query
    "wildcard*" (Only one
    word withing the phrase) I'm getting another exception:

    HTTP ERROR: 500
    Unknown query type "org.apache.lucene.search.PrefixQuery"
    found in phrase
    query string "touch*"
    java.lang.IllegalArgumentException: Unknown query type
    "org.apache.lucene.search.PrefixQuery" found in phrase
    query string "touch*"

    Actually query string "touch*" is invalid. It should be equivalent of just touch*. What is your expectation from that query?


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Lichman at Jun 23, 2011 at 1:18 pm
    The same as touch*.
    Thanks.

    --
    View this message in context: http://lucene.472066.n3.nabble.com/ComplexPhraseQueryParser-with-multiple-fields-tp2879290p3099824.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedApr 29, '11 at 1:54p
activeJun 23, '11 at 1:18p
posts11
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase