4

I am using the Collective Solr 4.1.0 Search on our Plone 4.2.6 system. So far so good, there is one problem I was not yet able to fix. When the user enters 'Michael Smith' in the search field, the query get's passed to Solr as in the following example:

+((givenName:(Michael) (Smith)) OR (surname:(Michael) (Smith)))

This way both fields givenName and surname are only searched for Michael. I'd rather have it this way:

+((givenName:(Michael OR Smith)) OR (surname:(Michael OR Smith)))

Since I fetch the user entry with {value} or {base_value}, which automatically makes it (Michael) (Smith), I don't know how to tell Solr to put an 'OR' inbetween or how to change the user query anyway.

1 Answer 1

3

Browsing through another forum I just found the solution for my particular problem: parentheses. In the backend, when I enter +(surname:{base_value}), that is replaced by +(surname:(Michael) (Smith)). Smith is then used for the default field.

The simple solution here is to put {base_value} in parentheses. +surname:({base_value}) then becomes +surname:((Michael) (Smith)) and is automatically handled like having an 'OR' inbetween.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.