How To apply a Refinement automatically to a search

Trying to apply a refinement to a search automatically. In this case, only show matches who’s dates are after the current time (entries in the future). Each entry has a unix “date” field, and is searchable. I don’t quite understand how to apply this to the ais-configure, this is what I could come up with, but doesn’t work:

      :filter="{ date: date > Math.round((new Date()).getTime() / 1000)}"

Vue Instantsearch 2, Algolia search 4.

Hi @recordingservices,

The <ais-configure> only supports Algolia search parameters. The parameter filter doesn’t exist but filters does. The parameter accepts a string not an object. You should be able to use it like this:

<ais-configure :filters="'date > ' + (new Date('2019-01-01').getTime())" />

You don’t have to inline the value in the template you can leverage computed properties to clean up a bit the template. Here is an example that shows its usage. Here we don’t divide by 1000 because the date attribute is in milliseconds not seconds.

AH, thank you so much!