How can I search for all terms across two fields in Solr? -


all terms in query should present in combined content of fields. e.g. when search combination of terms document should returned if:

  • all terms present in 'description' field, 'metadata' field or both fields
  • or terms distributed on both fields (e.g. 1 term present in 'description' field , 2 remaining terms present in 'metadata' field)

so q.op=and across 2 separate fields. how should write query?

what if change indexing use single multivalue field instead of 2 separate fields, make scenario easier?

yup, can combine 2 fields single multivalued field using copyfield.

<copyfield source="metadata" dest="metadata_desc" /> <copyfield source="descrition" dest="metadata_desc" /> 

the query can formed q=metadata_desc:"some search"&q.op=and

with q.op search terms mandatory , should match document returned. default or.

this take care of matching in either of fields across fields.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -