Looked at that already the format is this:

public static Query parse(String query,
                          String[] fields,
                          Analyzer analyzer)
                   throws ParseExceptionParses a query which searches on the
fields specified.

If x fields are specified, this effectively constructs:


 (field1:query) (field2:query) (field3:query)...(fieldx:query)

my query "value" will not be the same.  This lets u query multiple field
with the same query, my query string will be different

        f_name = rob and l_name = outar or address = some value

stuff like that.

Plus there is no way of specifying OR and AND's.


Thanks,

Rob O
-----Original Message-----
From: Kelvin Tan [mailto:kelvin-lists@;relevanz.com]
Sent: Wednesday, November 13, 2002 9:42 AM
To: Lucene Users List
Subject: Re: Multiple field searches using AND and OR's


Rob,

I believe MultiFieldQueryParser will do the job for you...

Regards,
Kelvin


On Wed, 13 Nov 2002 08:58:36 -0500, Rob Outar said:
>Hello all,
>
>    I am wondering how I would do multiple field searches of the
form:
>
>    field1 = value and field2 = value2 or field2 = value3
>
>I am thinking that each one of the above would be a term query but
>how would I string them together with AND's and OR's?
>
>Any help would be appreciated.
>
>Thanks,
>
>Rob
>
>PS I found this in the FAQ, but I was wondering if there was any
>other way to do it:
>
>My documents have multiple fields, do I have to replicate a query
>for each of them ?
>Not necessarily. A simple solution is to index the documents using a
>general field that contains a concatenation of the content of all
>the searchable fields ('author', 'title', 'body' etc). This way, a
>simple query will search in entire document content.
>
>The disadvantage of this method is that you cannot boost certain
>fields relative to others. Note also the matches in longer documents
>results in lower ranking.
>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:lucene-user-
>[EMAIL PROTECTED]> For additional commands, e-mail:
><mailto:lucene-user-
>[EMAIL PROTECTED]>




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


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

Reply via email to