Dont get nested filters to work

Hi there,
i have a problem to filter my query. I created a facet for my value “expiryDate.timestamp”.

This is my code:

searchParameters: {
            filters: 'expiryDate.timestamp < 1511564401'
          }

Screenshot from algolia:
48

I dont get any results.

Thank you

Hello Lennart,

It looks like you are trying to compare an integer (111564401) with a string “1511564400”.

Please make sure to choose one or the other. In your case, an integer would be more appropriate.

Hope this helps,

Quentin

Hi Quentin, thanks for your hint. I replaced the int with date.now function. I’m probably not an expert in JS and Algolia. Can you give me a tipp how i can parse expiryDate.timestamp to an integer?

filters: ‘expiryDate.timestamp <’ + Date.now()

Thanks

Hi,

The problem is than your expireDate.timestamp in the JSON object stored in Algolia is a string, not an number.
In the filters parameters, everything is anyway a string, but the operators < > <= >= work only if the original JSON value stored in Algolia are numeric.

Arnaud.

1 Like