Help: Build query with multiple metadata with operators OR and AND

Hi,

I am working on a project, which passes parameters query, firstName, lastName, and gender, and the operator amount those parameters is AND.

the parameter firstName is mapped to personFirstName, and personPrimaryFirstName.
the parameter lastName is mapped to personLastName, and personPrimaryLastName.

For instance, If the query send firstName=John Mark, lastName=Smith, gender=Male and query=Movie:
user wants results meet below criterial:
(personFirstName=John OR personPrimaryFirstName=John OR personFirstName=Mark OR personPrimaryFirstName=Mark) AND
(personFirstName=Smith OR personPrimaryFirstName=Smith) AND
gender=Male AND query=Movie

The way I achieve above goal is to manipulate the query in hook-pre-process script like:
q[“query”] = Movie |[personFirstName:John personPrimaryFirstName:John personFirstName:Mark personPrimaryFirstName:Mark]
|[personFirstName:Smith personPrimaryFirstName:Smith] |gender=Male

Does a better solution exist?

Thanks

I think what you have for the specific example above will probably work but you would want to test that to make sure that is the case because I’m not really sure if the query processor would rewrite the query as part of it’s query optimisation.

Funnelback’s query language is not really designed to handle very complex structured queries. These are more suited to something like a database that is designed for working on highly structured data, with an emphasis on precision and completeness of results for a query, rather than the model employed by web search engines that favour relevancy and speed (over accuracy and completeness).

1 Like

Thanks for the explanation and advice.