lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin L. Cobb" <kevin.c...@emergint.com>
Subject RE: Help with Search Java Code set up
Date Wed, 26 Oct 2005 19:36:28 GMT
Yeah. The last post got me to reading more about BooleanQuery and this
opend up the flood gates. 

A question on the heels of this one though. I have documents indexed in
multiple fields. Lets say Name, Synonym, and Definition. Lets say the
search phrase is "big green cat". What I'm building using the
BooleanQuery object is:

	+((Name:big Name:green Name:cat) (Synonym:big Synonym:green
Synonym:cat))
	(Definition:big Definition:green Definition:cat)) 

I'm getting too many 100% hits back when the search term is say "cat". I
want a Query that is more descerning, so that the term "cat" returns a
hit but less than 100%. The term "big green cat" should return 100%, the
term "big green" or "green big" should return something less than 100%
and then term "big" or "green" or "cat" something less that the previous
one. Hope this makes since. 

-Thanks, 

Kevin


 

-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com] 
Sent: Wednesday, October 26, 2005 2:38 PM
To: java-user@lucene.apache.org
Subject: Re: Help with Search Java Code set up

Are you simply looking to use multiple terms in your search?  In that
case, simply use BooleanQuery instead of TermQuery.  QueryParser will
recognize strings like    foo AND bar    or    +foo +bar    and turn
that into a BooleanQuery for you.

Otis

--- "Kevin L. Cobb" <kevin.cobb@emergint.com> wrote:

> I've been using Lucene happily for a couple of years now. But, this 
> new search functionality I'm trying to add is somewhat different that 
> what I'm used to doing. Would help if the smart folks on this list 
> would drive me in the right direction.
>  
> I have several "searchable" fields and one keyword field in my index.
> I
> usually work with EITHER the keyword or the searchable (non-keyword) 
> fields at a time, but this time I want to deal with them together. I 
> need to be able to do a term search in the "searchable" fields but at 
> the same time apply another term to the keyword field.
>  
> At this point, I'm thinking that I'll need to do two distinct 
> searches, one using the search term in what I'm calling my searchable 
> fields, and the other using the other term in the keyword field. Then 
> join the two HIT lists together.
>  
> Looking for some advice. 
>  
> Thanks,
>  
> Kevin
>  
> 
>  
> 


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




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


Mime
View raw message