FAQ
what is the status of the default operator feature of QueryParser?

i want to have a lucene enabled app using AND as it's default operator
using the code:

QueryParser parser = new QueryParser(FIELD, service.getAnalyzer());
parser.setOperator(parser.DEFAULT_OPERATOR_AND);
Query query = parser.parse(queryString, FIELD, service.getAnalyzer());

results are however not as expected but rather the QueryParser still
uses OR.

is this not the way i am supposed to use the feature?
why is it not working?
--
Mats Nyberg


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

Search Discussions

  • Paul Williams at Feb 18, 2004 at 9:08 am
    Mats,

    I believe when you call parser.parse with the Analyzer again you reset the
    state of default operator
    The following code should do what you want.


    QueryParser parser = new QueryParser( FIELD, service.getAnalyzer());
    parser.setOperator(QueryParser.DEFAULT_OPERATOR_AND);
    Query query = parser.parse(queryString);

    Regards,

    Paul



    -----Original Message-----
    From: Mats Nyberg
    Sent: 18 February 2004 11:06
    To: Lucene Users List
    Subject: status of AND as default logical operator for QueryParser


    what is the status of the default operator feature of QueryParser?

    i want to have a lucene enabled app using AND as it's default operator using
    the code:

    QueryParser parser = new QueryParser(FIELD, service.getAnalyzer());
    parser.setOperator(parser.DEFAULT_OPERATOR_AND);
    Query query = parser.parse(queryString, FIELD, service.getAnalyzer());

    results are however not as expected but rather the QueryParser still uses
    OR.

    is this not the way i am supposed to use the feature?
    why is it not working?
    --
    Mats Nyberg


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org
    DISCLAIMER:
    The information in this message is confidential and may be legally
    privileged. It is intended solely for the addressee. Access to this message
    by anyone else is unauthorised. If you are not the intended recipient, any
    disclosure, copying, or distribution of the message, or any action or
    omission taken by you in reliance on it, is prohibited and may be unlawful.
    Please immediately contact the sender if you have received this message in
    error.
    Thank you.
    Valid Information Systems Limited. Address: Morline House, 160 London
    Road, Barking, Essex, IG11 8BB.
    http://www.valinf.com Tel: +44 (0) 20 8215 1414 Fax: +44 (0) 20 8215 2040
    -----------------------------------------
    Be a part of Summit 2004 Hummingbird's Worldwide Conference & Technology
    Showcase February 22-25, 2004 The Westin Diplomat Resort, Hollywood,
    Florida, Visit our Web Site: http://www.hummingbird.com/summit for more
    information.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org
  • Mats Nyberg at Feb 18, 2004 at 9:41 am
    thanks paul, worked like a charm.

    On Wed, 2004-02-18 at 08:06, Paul Williams wrote:
    Mats,

    I believe when you call parser.parse with the Analyzer again you reset the
    state of default operator
    The following code should do what you want.


    QueryParser parser = new QueryParser( FIELD, service.getAnalyzer());
    parser.setOperator(QueryParser.DEFAULT_OPERATOR_AND);
    Query query = parser.parse(queryString);

    Regards,

    Paul



    -----Original Message-----
    From: Mats Nyberg
    Sent: 18 February 2004 11:06
    To: Lucene Users List
    Subject: status of AND as default logical operator for QueryParser


    what is the status of the default operator feature of QueryParser?

    i want to have a lucene enabled app using AND as it's default operator using
    the code:

    QueryParser parser = new QueryParser(FIELD, service.getAnalyzer());
    parser.setOperator(parser.DEFAULT_OPERATOR_AND);
    Query query = parser.parse(queryString, FIELD, service.getAnalyzer());

    results are however not as expected but rather the QueryParser still uses
    OR.

    is this not the way i am supposed to use the feature?
    why is it not working?

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedFeb 18, '04 at 9:01a
activeFeb 18, '04 at 9:41a
posts3
users2
websitelucene.apache.org

2 users in discussion

Mats Nyberg: 2 posts Paul Williams: 1 post

People

Translate

site design / logo © 2022 Grokbase