itemsjs: Adding an aggregation which is not a collection property (e.g. years) breaks search

Hi, This is a very interesting and extremely useful project.

I’m just encountering a slight problem when I extend the filter configuration with a pure ‘scalar’ value. In order to situate the problem as clear as problem, allow me to refer to your movie sample. (https://jsfiddle.net/cigol/0ef9qeos/5/) When in this sample, you change the configuration as follows:

    year: {
      title: 'Year',
      size: 10
    }

the search isn’t working any longer. Did I miss something? You can find the updated jsfiddle reproducing the problem here as well: https://jsfiddle.net/paulvb/86xbs4jd/ So, basically the ‘year list’, the bucket list so to speak is built up correctly but when you select a year, things break.

Thanks a lot paul.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

As I understand it, itemsjs does check for exact matches in the filters. It would be great if it supported numbers and boolean in addition to strings. It seems a bit odd that as a user I have to convert numbers to strings to make them work in facets. Or am I missing something?

Paul, the each year field in file you are including in jsfiddle https://cdn.rawgit.com/itemsapi/itemsapi-example-data/master/jsfiddle/imdb.js should be as a string then it should work

Yes but inside a vue-js app. But that reminds me that native web components are possible now: https://github.com/vuejs/vue-web-component-wrapper

I found out that the problem only happens when it is about a field that has a scalar value. If for example I change one of the tag fields from ganster to ga “tags”: [“ga”, “organized crime”, “mafia”, “rise and fall”, “cold blooded murder”], then the search on ga will return only one item (as expected). So, the year property is not a collection property but a scalar and that’s when it goes wrong 😃