lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ces3w <>
Subject Querying Lucene property for exact value
Date Thu, 05 May 2011 18:03:21 GMT

I am new to Lucene, so I apologize if this has been answered, but I've had
no success finding the answer after googling around.  I am using Compass as
a Lucene front end and have run into an issue in querying Lucene docs.  I am
looking for a way to search a property based on it's complete and exact
value, not based on a keyword within the property.  

An example is that I have an Activity field that can be one of many values
including 'patrol', 'unit patrol', 'police patrol', etc.  With my query, I
would like to only return 'patrol' items and nothing else.  Is there a way
to do this??  My current querying code is below. This returns all items with
'patrol' in it.

Note: values and field are variables passed to the method indicating
possible values the lucene field can be.

CompassQueryBuilder.CompassBooleanQueryBuilder boolQuery =
for (String value : values) {
        CompassQuery t = queryBuilder.term(field, value);
return boolQuery.toQuery();

Any help would be greatly appreciated.



View this message in context:
Sent from the Lucene - Java Users mailing list archive at

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

View raw message