Seems the pySearchMethod gets ignored if relying on the filter criteria in the report definition and don't use or rather pass pySearchString as empty. If we pass say a concatenation of the params from the report definition filters to pySearchString then the pySearchMethod is used correctly.
Having changed PegaSearch.Searcher.ESQueryGenerator to Debug I can now see the ElasticSearch generated query string.
Seems the problem is related to spaces in parameters that are passed into the query definition.
So in my example :- E AND (A OR B OR (B AND C AND D) OR (B AND C AND F) OR (B AND D AND F) OR (C AND D AND F))
If C was say a UK Postcode similar to M1 5EA it's treated as 2 separate strings not one.
Therefore we end up with this elasticsearch query string :-
( ( ( ( C:m1 OR C:5ea ) AND D:jones ) OR ( ( C:m1 OR C:5ea ) AND F:mike ) OR ( D:jones AND F:mike ) OR ( ( C:m1 OR C:5ea ) AND D:jones AND F:mike ) ) ) AND pxObjClass:Work-Svc*
Which is clearly wrong. Is this a bug? When this query is sent to the database the space in the parameters are not separated like this they are wrapped in quotes. This is how elasticsearch should be.
I tried circumventing this behaviour by wrapping the parameter in quotes both single and double. But they are stripped away before creating the query string. Again this seems like a deliberate thing to do and from my perspective is a bug.
Please set pyUseTokenizer=false for pyFilter with name=pyCategory in the virtual report definition And use that virtual report definition in pxRetrieveSearchData by setting the property pyReportPageName Then a query will be created without OR operator And you will get correct results