lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terry Steichen <>
Subject Re: Collecting documents where only one field term matches
Date Mon, 04 Apr 2005 15:38:48 GMT
I wonder if you could accomplish your goal by creating another field 
during indexing which holds the number of terms in the "species" field.  
If that's possible, then you might get what you want with a query like: 
+species:"homo sapien" +num_species:1.

mad Cow wrote:

> Could some more experienced users suggest a solution to my problem. I 
> have documents which contain multiple terms and phrases, and I wish to 
> collect documents which match only the term I query for.
> For example:
> Doc1 contains,
>   species:"homo sapien" Mammalia
> Doc2 contains,
>   species:"homo sapien"
> I wish to collect documents ONLY with "homo sapien" but a search for 
> species:"homo sapien" returns both documents as they both contain the 
> phrase.
> I have written code to cache every term for every field an I hoped 
> that I could do the search - species:"homo sapien" -species:Mammalia. 
> Unfortunately the terms homo and sapien seem to be separate.  So when 
> I collect every term to use with the "-" operator I end up with a 
> query thus
> species:"homo sapien" -species:(homo Mammalia sapien)
> which isn't the same.
> Can anybody suggest another approach?
> Many thanks
> Iain
> _________________________________________________________________
> It's fast, it's easy and it's free. Get MSN Messenger today! 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message