Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Ability to get all refined values #70

Closed
redox opened this issue May 7, 2015 · 8 comments
Closed

Ability to get all refined values #70

redox opened this issue May 7, 2015 · 8 comments
Assignees
Milestone

Comments

@redox
Copy link
Contributor

redox commented May 7, 2015

Something like helper.getRefinements(facet) -> ["value1", "value2", ...]

@bobylito bobylito added this to the 2.1.0 milestone May 12, 2015
@bobylito
Copy link
Contributor

bobylito commented Jun 1, 2015

@redox should it work for any kind of refinement? Or should we have different methods for each type of refinement?

@bobylito bobylito self-assigned this Jun 1, 2015
@redox
Copy link
Contributor Author

redox commented Jun 1, 2015

Hmmm, I would say any kind:

addRefine('c1', 'v1');
addDisjunctiveRefine('d1', 'v1');
addDisjunctiveRefine('d1', 'v2');
addRefine('c2', 'v1');
addExclude('c2', 'v2');

getRefinements('c1') -> ['v1']
getRefinements('d1') -> ['v1', 'v2']
getRefinements('c2') -> ['v1', '-v2'] // with a "-" ? -> not sure about that one

@bobylito
Copy link
Contributor

bobylito commented Jun 2, 2015

Humm different types of refinements. I see three options here :

  • one function, return the values for all refinements, without distinction. The context should be obvious, but that may not be the case for exclusions
  • one function, return the values for all refinements, with a more structured data (map containing the type of refinement as the key) or labels (tuple of type, value?). it's less obvious to read.
  • one function per type, returns a list of values for the type. We need to provide less information, the user should know which function to call because he knows the context. Makes more API...

I would vote for the last one but each solution has its pros/cons

@redox
Copy link
Contributor Author

redox commented Jun 2, 2015

The use case was to efficiently/quickly build a list of all active refinements on top of the page, with the ability to remove filters clicking on them. The last option should work, not yet sure it's the most efficient way to do it because of the switch/case on the type of the facet that could make things more complex.

Ideally I would like to write something like on top on my hits:

FOREACH facet IN facets:
  FOREACH refinement IN helper.getRefinements(facet):
     <span class="label">refinement <a href="#" ngclick="helper.removeRefinement(facet, refinement)">x</a></span>

@redox
Copy link
Contributor Author

redox commented Jun 2, 2015

The getRefinements would then only be at the AlgoliaSearchHelper level, and the "one function per type" at the SearchParameter level.

@bobylito
Copy link
Contributor

bobylito commented Jun 3, 2015

I'm ok with you latter comment but don't you think that each kind of facetting has its own UI?

@redox
Copy link
Contributor Author

redox commented Jun 3, 2015

They have their own UI in the facets, but if you want to add something on top of the results page they could share the same. But also, it's so easier to use because you just don't need to think about their types.

@bobylito
Copy link
Contributor

bobylito commented Jun 3, 2015

👍 Go then! :)

bobylito added a commit that referenced this issue Jun 4, 2015
 FIX #70 Ability to get all refined values : helper.getRefinements()
bobylito pushed a commit that referenced this issue Jun 15, 2015
  * FIX : #29 Avoid callback for outdated queries
  * FIX : #64 Sum up the processing time of all queries
  * FIX : #92 Parameters that can be set in the dashboard shouldn't have defaults
  * FIX : #62 Make sure disctinct is set to false when it's not possible to use distinct in Algolia
  * FEATURE : #91 Support for tags (with support for the raw format #98)
  * FEATURE : #70 Ability to get all refined values : helper.getRefinements( facetname )
  * FEATURE : #51 multiple filters for a single conjunctive facet (tests)
  * FEATURE : Ability to modify any parameter of the state easily (#76 #84 #12)
  * FEATURE : #69 Ability to know if a facet is refined, whatever the value
  * FEATURE : #86 Expose SearchParameters, AlgoliaSearchHelper, SearchResults to users directly in the builds
  * FEATURE : #25 let the user do a clearRefinement with a function as a filter
  * REFACTORING : SearchParameters is immutable (#14)
  * REFACTORING : Ensure SearchParameters is totally frozen (#14)
  * LIB : Update lodash version to 3.9.x
dhayab pushed a commit to algolia/instantsearch that referenced this issue Jul 10, 2023
dhayab pushed a commit to algolia/instantsearch that referenced this issue Jul 10, 2023
…ature/getRefinements

 FIX algolia/algoliasearch-helper-js#70 Ability to get all refined values : helper.getRefinements()
dhayab pushed a commit to algolia/instantsearch that referenced this issue Jul 10, 2023
  * FIX : algolia/algoliasearch-helper-js#29 Avoid callback for outdated queries
  * FIX : algolia/algoliasearch-helper-js#64 Sum up the processing time of all queries
  * FIX : algolia/algoliasearch-helper-js#92 Parameters that can be set in the dashboard shouldn't have defaults
  * FIX : algolia/algoliasearch-helper-js#62 Make sure disctinct is set to false when it's not possible to use distinct in Algolia
  * FEATURE : algolia/algoliasearch-helper-js#91 Support for tags (with support for the raw format #98)
  * FEATURE : algolia/algoliasearch-helper-js#70 Ability to get all refined values : helper.getRefinements( facetname )
  * FEATURE : algolia/algoliasearch-helper-js#51 multiple filters for a single conjunctive facet (tests)
  * FEATURE : Ability to modify any parameter of the state easily (algolia/algoliasearch-helper-js#76 #84 #12)
  * FEATURE : algolia/algoliasearch-helper-js#69 Ability to know if a facet is refined, whatever the value
  * FEATURE : algolia/algoliasearch-helper-js#86 Expose SearchParameters, AlgoliaSearchHelper, SearchResults to users directly in the builds
  * FEATURE : algolia/algoliasearch-helper-js#25 let the user do a clearRefinement with a function as a filter
  * REFACTORING : SearchParameters is immutable (algolia/algoliasearch-helper-js#14)
  * REFACTORING : Ensure SearchParameters is totally frozen (algolia/algoliasearch-helper-js#14)
  * LIB : Update lodash version to 3.9.x
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