question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement dynamic facets

See original GitHub issue

Do you want to request a feature or report a bug? This is a feature request – both for instantsearch.js and react-instantsearch. It might make sense to have something implemented in the Helper that would then be leveraged in instantsearch.js.

Feature: What is your use case for such a feature? This is a need mainly stemming from e-commerce use cases, but could be useful for any use case that involves a wide variety of facets. In large e-commerce selling many different types of products (from electronic devices to groceries), displaying the facets that make sense for any given search is a problem. Besides the generic price, brand or categories facets, there’s no way to know in advance what will make sense to display in the facets.
If a user searches for tv you’ll want to display facets for connectivity, size of screen, screen technology, etc. — for a query like printer you’d display things like number of pages per minutes, included scanner, connectivity, and so on.

The way we solve this today is by doing the following:

  • Each record has two attributes: relevant_properties and properties. They’d look something like this:
    •   {
          "properties": {
            "Connectivity": ["HDMI", "WiFi"],
            "Screen Size": "50"
          },
          "relevant_properties": ["Connectivity", "Screen Size"]
        }
      
  • relevant_properties and properties are added to the attributes for faceting
  • at each keystroke, a first search query is sent with the query string (+ possible active facets), facets=['relevant_properties'] and hitsPerPage=0. This retrieves the properties that are the most represented in the query results.
  • Once the results come back for that first query, a second query is sent to actually fetch the hits, along with the facets that have been returned/extracted from the results of the first query.

I have built a fiddle to demonstrate this using the JS helper: https://jsfiddle.net/rbbosLh3/ Unfortunately the only dataset I had handy for this usecase is a french one, sorry.

Feature: What is your proposed API entry? The new option to add? What is the behavior? Today there’s no (easy) way to dynamically remove/add widgets in an instant search implementation, which makes it hard to implement this solution.

I’m not sure what should be the API/modifications made to our libs to make this work, but it would be nice to have something friendlier than going back down to the helper for this.

What project are you opening an issue for?

  • react-instantsearch
  • instantsearch.js
  • algoliasearch-helper?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Implementing faceted search with dynamic faceting (code ...
Learn to implement dynamic faceting, the most relevant form of faceted search. We describe a search query cycle: request, execution, ...
Read more >
Use Dynamic Facets - Coveo Documentation
You may want some, or all dynamic facets in a search interface to appear in a specific order rather than being automatically reordered...
Read more >
Dynamic Faceting using Query Rules - GitHub
Guide to implement Dynamic faceting using React InstantSearch and Query Rules - GitHub ... Prerequisites: Algolia, react-instantsearch, Query Rules, facets ...
Read more >
Dynamic Faceted Search for Discovery-driven Analysis
ABSTRACT. We propose a dynamic faceted search system for discovery- driven analysis on data with both textual content and struc- tured attributes.
Read more >
DynamicFacet | Coveo JavaScript Search Framework
This facet is more easy to use than the original Facet component. It implements additional Coveo Machine Learning (Coveo ML) features such as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found