Reputation: 23094
All terms in the query should be present in the combined content of the fields. E.g. when I search for a combination of terms a document should be returned if:
So q.op=AND
but across two separate fields. How should I write my query?
What if I change the indexing to use a single multivalue field instead of two separate fields, does that make this scenario easier?
Upvotes: 0
Views: 161
Reputation: 52799
Yup, you can combine the two fields into a single multivalued field using copyfield.
<copyField source="metadata" dest="metadata_desc" />
<copyField source="descrition" dest="metadata_desc" />
The query can be formed with q=metadata_desc:"some search"&q.op=AND
With q.op
the search for all the terms would be mandatory and should match for a document to be returned. The default is OR
.
This will take care of matching it in either of the fields as well as across the fields.
Upvotes: 3