Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

numericRefinementList for filtering on date and time for event records #414

Closed
mycaule opened this issue Mar 28, 2018 · 9 comments
Closed
Milestone

Comments

@mycaule
Copy link

mycaule commented Mar 28, 2018

Please implement numericRefinementList in the vue version of the library.

The goal would be to make a date filter as mentioned in https://discourse.algolia.com/t/filter-by-date-instantsearch/2858

@Haroenv
Copy link
Contributor

Haroenv commented Mar 29, 2018

Thanks for bringing this to our attention. We will actually rework the way numeric ranges etc. are working specifically for dates all around InstantSearch in the coming time. Could you for that reason explain which behaviour you exactly want to achieve? i.e. what kind of data you have, how you want to refine etc.

Thanks!

@Haroenv Haroenv added this to the V2 milestone Mar 29, 2018
@mycaule
Copy link
Author

mycaule commented Mar 29, 2018

I have a list of events which I would like to filter by date preferably using a calendar UI component.

  • 1, Filter by date range
  • 2, Filter by hours range

I stored the date in the index using a numeric timestamp (UNIX time in seconds), and would like to use it as a facet.

It looks like the usecase has already been studied using the regular vanilla InstantSearch.js library.

The demo is available on https://mycaule.github.io/tango-search/.

@Haroenv
Copy link
Contributor

Haroenv commented Mar 29, 2018

So to be clear, every record in your index has a single timestamp, and you want to have a refinement like this?

             from             to         
             [                ]          
  x     x    o  o o      o  o   x x x   x
    x     x   o     o o       o x   x  x 

with x being record not matched, and o being record matches?

@mycaule
Copy link
Author

mycaule commented Mar 29, 2018

Yes indeed. My records look like this:

{
      "name": "Abrazo Tango",
      "tags": [
        "milonga"
      ],
      "date": {
        "weekday": "jeudi",
        "day": 29,
        "month": 3,
        "year": 2018,
        "timestamp": 1522281600
      },
      "time": {
        "begin": "15:00",
        "end": "20:00"
      },
      "location": {
        "address": "105 rue de Tolbiac",
        "city": "Paris",
        "postcode": 75013
      },
      "price": 5
}

That way as a developer I expect these filter to be already implemented in vue :

  • date range filter (eg. user is available from March 29 to March 31)
  • time range filter (eg. user is available from 18:00 to 19:00)

The events search use case is a common use case in my opinion (think of Google Calendar, Meetup.com etc...)

Something like https://github.com/airbnb/react-dates would be awesome as mentioned by algolia team members here algolia/instantsearch#1077

@Haroenv
Copy link
Contributor

Haroenv commented Mar 29, 2018

🤔 Would it also make sense to have both of those things in two timestamps instead:

{
  "date": {
    "from": 1522281600, // 15h, 29/3
    "to": 1522281600 // 20h, 29/3
  }
}

For your use case, if you use the date/time picker, the events need to be completely within the range you give right? You wouldn't want to match things which partially overlap with the range?

@mycaule
Copy link
Author

mycaule commented Mar 29, 2018

If I want to get every events happening on tuesday at 6pm for the next month, I would not be able to filter with these fields, it would require more calculation.

That's why I just store the hours, not the full date + hours unix format. But I agree that it's easier to store the hours as numeric values instead of strings.

There is this recommendation if you want to see how to store and event record in a more ideal way http://schema.org/Event

I still need a date and time picker which is still not provided by vue-instantsearch

@mycaule mycaule changed the title numericRefinementList numericRefinementList for filtering on date and time for event records Mar 29, 2018
@Haroenv
Copy link
Contributor

Haroenv commented Mar 29, 2018

I’m aware that Vue InstantSearch doesn’t have this feature yet, I’m just thinking what you exactly need

@mycaule
Copy link
Author

mycaule commented Sep 5, 2018

Closing this thank you very much.

@mycaule mycaule closed this as completed Sep 5, 2018
@Haroenv
Copy link
Contributor

Haroenv commented Sep 5, 2018

We will keep this issue in mind, when we make this a built-in future in the future. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants