Hi,
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 =
queryBuilder.bool();
for (String value : values) {
CompassQuery t = queryBuilder.term(field, value);
boolQuery.addShould(t);
}
return boolQuery.toQuery();
Any help would be greatly appreciated.
Thanks,
Chelsea
--
View this message in context:
http://lucene.472066.n3.nabble.com/Querying-Lucene-property-for-exact-value-tp2904431p2904431.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]