lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kelvin Tan <kelvin-li...@relevanz.com>
Subject RE: Searching on multiple default fields
Date Wed, 14 May 2003 09:48:51 GMT
ack. THe DEFAULT_BOOLEAN_OPERATOR field is inherited from QueryParser and isn't 
used by MultiFieldQueryParser at all. The javadocs of the parse method in MFQP 
says...

     * Parses a query, searching on the fields specified.
     * Use this if you need to specify certain fields as required,
     * and others as prohibited.
     * <p><pre>
     * Usage:
     * <code>
     * String[] fields = {"filename", "contents", "description"};
     * int[] flags = {MultiFieldQueryParser.NORMAL FIELD,
     *                MultiFieldQueryParser.REQUIRED FIELD,
     *                MultiFieldQueryParser.PROHIBITED FIELD,};
     * parse(query, fields, flags, analyzer);
     * </code>
     * </pre>
     *<p>
     * The code above would construct a query:
     * <pre>
     * <code>
     * (filename:query) +(contents:query) -(description:query)
     * </code>
     * </pre>

HTH

Kelvin

On Wed, 14 May 2003 14:14:05 +0530, Ramrakhiani, Vikas said:
>I observed that when I use parse(QueryString, Fields[], Analyser) my
>DEFALUT_BOOLEAN_OPERATOR  is changed to OR although I had set it to
>AND.
>
>MultiFieldQueryParser qp =
>new MultiFieldQueryParser("content", myAnalyzer);  
>//QueryParser qp =
>//new QueryParser("content", myAnalyzer);
>
>qp.setOperator(MultiFieldQueryParser.DEFAULT_OPERATOR_AND);
>
>System.out.println("Default operator is: " +
>qp.getOperator());
>
>String[] fields = getFieldList();
>System.out.println("fields: " + fields);
>
>query = qp.parse(queryString, fields, myAnalyzer);
>//query = qp.parse(queryString);
>
>System.out.println("The lucene query: " +
>query.toString(""));
>
>Any reason for this ?
>
>thanks for your help,
>vikas.
>
>-----Original Message-----
>From: Kelvin Tan [mailto:kelvin-lists@relevanz.com]
>Sent: Tuesday, May 13, 2003 1:11 PM
>To: Lucene Users List
>Subject: Re: Searching on multiple default fields
>
>
>You can use MultiFieldQueryParser to accomplish something to that
>effect...
>
>Kelvin
>
>On Tue, 13 May 2003 13:05:42 +0530, Ramrakhiani, Vikas said:
>>Hi,
>>
>>I am using Lucene 1.3. I want the 'default' search field to point to
>>multiple fields (actually, all available fields).
>>Is there API support to accomplish this ?
>>
>>thanks for your help,
>>vikas.
>>
>>--------------------------------------------------------------------
>>-
>>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org





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


Mime
View raw message