lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Outar" <rou...@ideorlando.org>
Subject RE: Multiple field searches using AND and OR's
Date Wed, 13 Nov 2002 18:02:05 GMT
Thanks Otis, one other question the constructor's are kind of odd for the
QueryParser class:

Constructor Summary
QueryParser(CharStream stream)

QueryParser(QueryParserTokenManager tm)

QueryParser(String f, Analyzer a)
          Constructs a query parser.

I guess I can create one using:

QueryParser(String f, Analyzer a)

But when I call query(String query) will it form the Query object
disreguarding the argument I passed in the constructor?

Let me know.

Thanks,

Rob Outar
OneSAF A&I -- SAIC
Software\Data Engineer
321-235-7660
outarr@saic.com <mailto:outarr@saic.com>


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Wednesday, November 13, 2002 10:28 AM
To: Lucene Users List
Subject: RE: Multiple field searches using AND and OR's


The QueryParser will handle input such as field1:value1 AND
field2:value2 OR field3:value3, and will construct the appropriate term
and boolean queries.

See Query Syntax page.

Otis


--- Rob Outar <routar@ideorlando.org> wrote:
> 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-
> >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>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
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>


Mime
View raw message