How to filter event date range search by metadata field

This might be a dumb question, but I take it that “Combining Faceted Navigation and the Event Search query processing mode is not supported.” (Event Search - Funnelback Documentation - Version 15.10.0) means I can’t use both of these parameters together in a query:

  • meta_4=somevalue
  • query=%25O>20170913<20170918

It doesn’t seem to filter by the metadata value at all.
Is there another way to do it, like remove the non-matching results in hook_post_process?

Hi David,

I’m pretty sure you can combine metadata contraints and event constraints - but you have to make sure that the event params are at the end of the query as processed. You can’t use faceted navigation with events mode though.

I have a vague recollection of raising a bug about how the query is built from CGI parameters, meaning that the meta constraint is lost because of where it ends up in the built query.

Try building the query directly yourself.

Instead of
meta_4=somevalue
query=%25O>20170913<20170918

use

query= 4:somevalue % O>20170913<20170918

cheers,
Peter

Hi David,

It seems another workaround might be to use the system query field to inject the event parameters.

So you should be able to use

meta_4=somevalue
s=%25O>20170913<20170918

as well.

Can you have a look at the json response for each of the three cases and note what value appears in the response.resultPacket.queryAsProcessed field?

cheers,
Peter

Thanks Peter, you’re exactly right! The metadata field gets appended to the end of the date range query and thus ignored:

"queryAsProcessed": "% O>20170913<20170918 4:somevalue"

Using either of the methods you mentioned yields successful results:

  • query=4:somevalue%25O>20170913<20170918
  • meta_4=somevalue&s=%25O>20170913<20170918

"queryAsProcessed": "4:370504 % O>20170913<20170918",

In my particular situation, the date range query is being added by a hook script, so I’ll need to update the script to set it differently. Hmm it might even be a bug in the script that’s doing this, rather than a bug in Funnelback. Will investigate deeper..

Thanks for checking that.

Try getting your hook script to set the date in the system query field - that might solve the problem for you and sort of makes more sense anyway since it’s system generated.

Thanks would that be querySystemRaw?

Hmm no that’s not part of the question.
I might need some more direction on how to do that.. should I add “s” to the inputParameterMap ?

Added:

q.inputParameterMap["s"] = "%"+event_query;

Update: this seems to be working when there’s no text query, but when there is, it’s still including other results that match the text query. Eg with these params:

&query=medicine%20+4:370504%25O>20170913<20170918
I get
queryAsProcessed":"medicine 4:370504 % O>20170913<20170918"
And results that match “medicine” but not “370504”.

As you can see, I tried adding a plus to see if that made a difference, but it’s getting stripped out. Interestingly a minus doesn’t get stripped out, and works as expected.

Using a combination of event query syntax and system-constrained inputs, you might want to try:

  • smeta_4=370504 (system-generated parameter for constraint on metadata field ‘4’)
  • query=medicine % O>20170913<20170918 (standard query and event search syntax)

Refer:

This article might also be of help re. s: Redirect Notice

If you need all constraints to be matched you can set Funnelback to only return fully matching results (-fmo=on query processor option, or &fmo=on as a CGI parameter).

I’m not sure if Gordon’s suggestion will work (I think it might suffer from the same bug as your original post with the value inserted at the end of the query as processed - my reading of it was that the system generated paramaters were placed on the end of the query string). However worth a try.

Thanks guys, just realised I forget to submit my last comment:
I’d forgotten to urlencode the plus, so it was being converted to a space. Changed to %2B and it’s all working!!!

FMO is switched on (i wondered what FMO stands for, assumed Fear of Missing Out)

fully matching only :slight_smile: