Reputation: 1939
According to this page:
http://lucene.apache.org/core/old_versioned_docs/versions/2_9_1/queryparsersyntax.html
you can do searches like
title:"The Right Way" AND text:go
I would like to add a new field "testfield" that contains multiple values like {A,B,C,E}.
So I could get one search result #1 who's "testfield" = {A,B,C,E} another search result #2 who's "testfield" = {C,E,D,F}.
My goal is to be able to do searches like:
testfield:"C" AND testfield:"E"
In this case it should return both search results #1 and #2.
However, if I do:
testfield:"A" OR testfield:"B"
then I should only get search result #1.
How can a add a new lucene field to accomplish doing simple queries like I described above?
Upvotes: 0
Views: 78
Reputation: 19791
Add the field several times, something like ...
document.Add(new Field("testfield", "A"));
document.Add(new Field("testfield", "B"));
document.Add(new Field("testfield", "C"));
Upvotes: 2