instantsearch icon indicating copy to clipboard operation
instantsearch copied to clipboard

Wildcard doesn't work on facets, if disjunctiveFacets are declared

Open kokliKo opened this issue 8 years ago • 12 comments

If I do

var helper = algoliasearchHelper(client, 'indexName', {
  facets: '*',  // or   facets: ['*'],
  disjunctiveFacets: ['brand']
});

I only retrieve the facet "brand". Since I passed the wildcard to facets, I'd like to retrieve all facets, but only have the "brand" as a disjunctive facet.

This bug is only existing when a disjunctiveFacet is passed.

kokliKo avatar Sep 30 '16 01:09 kokliKo

Hey @kokliKo thanks for the bug, I'll look into it ASAP. Just for my information, why can't you enumerate the facets? Do you want brand to be both disjunctive and conjunctive?

bobylito avatar Sep 30 '16 07:09 bobylito

Thanks!

  • "Why can't you enumerate the facets" -> I'm not sure exactly why they can't on their side
  • "brand" should be disjunctive only IMO

kokliKo avatar Sep 30 '16 15:09 kokliKo

Hey @bobylito, have you had time to look at this one?

kokliKo avatar Oct 14 '16 08:10 kokliKo

Not yet.

bobylito avatar Oct 14 '16 09:10 bobylito

Following up on some of our offline conversations with @kokliKo:

Ok so if we dumb down what the requirements are, this would give us:

  • make wildcard / * usable on conjunctive facets with facets: '*' (no need for an array here)
  • other facet won't benefit from the wildcard
  • any facet definition that are defined as another kind of facet will be considered not conjunctive

Some cons about that are that:

  • checks that test if a conjunctive facet is defined will be virtually disabled making mistakes more likely to happen (like refining of a typoed facet name)
  • API is not symmetrical
  • all the possible facets will be downloaded

In this conditions that seems to be doable but it is still not trivial. I don't think I'll have the bandwidth to handle it right away but I'll make sure to add it to the next release that contains new features (after the release of react-instantsearch)

bobylito avatar Oct 17 '16 15:10 bobylito

This feature is low priority. Will close for now. Let me know if it's a blocker.

bobylito avatar Jan 27 '17 16:01 bobylito

@bobylito Any chance to make this possible coz I also came across the same requirement 2 weeks back and was trying to find a way how to do this. The reason why we need to make it wildcard is that we have 2 websites which share same codebase and these websites is using different facets. So we need to make it somehow dynamic instead of enumerating all the facets for each website

nelsieborja avatar Sep 07 '17 12:09 nelsieborja

Thanks @nelsieborja for your feedback. As I said, it could be possible but with some limitations. I will sync up with the JS team at Algolia to see how can we manage to prioritize this feature.

bobylito avatar Sep 07 '17 13:09 bobylito

@bobylito Thanks for considering this. Was able to find a quick and possible adjustment in the code to achieve the said requirement. So you can add this feature in your own time ;)

nelsieborja avatar Sep 12 '17 08:09 nelsieborja

Hi, I'm trying to retrieve all the facets of the result set by querying with

{
  facets: ['*'],
  ...
}

I'm not even setting a value for disjunctiveFacets and still getting a result with an empty array in the facets key. Is this supported?

According to this: https://www.algolia.com/doc/guides/searching/faceting/?language=javascript#retrieving-facets it should work.

mapolonio avatar May 14 '18 20:05 mapolonio

Hey @mapolonio, could you open a new issue with a codepen for reproduction please?

Haroenv avatar May 14 '18 20:05 Haroenv

@Haroenv here it is https://github.com/algolia/algoliasearch-helper-js/issues/607

mapolonio avatar May 15 '18 13:05 mapolonio