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.

Ability to use multiple fields in range widget

See original GitHub issue

We are implementing an instantsearch on our wocommerce site, and in our scenario we store prices in many fields (ie. depending on current user group - they will receive a certain discount, ie.:

{
id: 123,
title: "apple ipad 32gb black",
price: 200,
price_groupA: 180,
price_groupB: 160,
price_groupC: 150
}

We basically want to be able to generate the request with the OR condition on all price fields that are relevant to currently logged in user. current range widget is based solely on 1 price “field” and I don’t seem to be able to find anything for query override, ie. current query would translate to something like: SELECT * FROM products WHERE price BETWEEN 50 AND 100

But i’d like to be able to re-construct that query before it is sent to algolia to convert to something like: SELECT * FROM products WHERE price BETWEEN 50 AND 100 OR price_groupA BETWEEN 50 AND 100 OR price_groupC BETWEEN 50 AND 100

Example that I showed nearly doesn’t make any sense, but I was trying to make it a little more clear. Real reason is that our user can be member of multiple user groups at the same time, and we want to provide best possible price based on their user group - price associations.

Is this even a right approach? if it is - how can we achieve this type of behaviour, and if it’s not - is there something that anyone could recommend to solve this problem?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
pixelasticcommented, Sep 12, 2016

The use-case seems to make sense. I still have trouble correctly figuring out in my head how a “sort by price” ordering of the results will look, when filtering with on multiple price attributes.

Also, wouldn’t it be possible achieve the same effect by adding new attributes to the records? Like price_min and price_max being the min and max values of all the price, price_groupA, price_groupB and price_groupC, and we do the filtering on those values. Granted, we would need to compute these min/max for all possible combination of groups, which will quickly be cumbersome.

Overall I think it makes sense to integrate it in instantsearch (even if I’m not sure how to do it), but it will require some real-life testing to make sure it solves more issue than it creates (surprising results).

My 2cts 😃

0reactions
dhayabcommented, Dec 19, 2022

Closing this issue, guidance on achieving this using a custom widget has been provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add a Range Widget to Filter Dashboard Results Based on a ...
A range widget allows dashboard viewers to filter the CRM Analytics dashboard results based on a range of values for a measure. For...
Read more >
Multiple Source Table Widget (CX) - Qualtrics
The multiple source table widget displays a metric value (such as count, average, etc.) for multiple fields in a single table. Each field...
Read more >
How to combine multiple range slicers with AND logic
Hi,. I'm trying to filter lot of data through the use of couple of range slicers. What I found out is that these...
Read more >
custom searching for a date range, with multiple fields and ...
I'm using datatables on a plethora of pages, often multiple per page. I'm doing the column based filtering, which works fine for most...
Read more >
Can't Clone Date or Range Widgets - Multiple Pages ... - SFDCr
In my opinion, it is the preferred workaround because it create a truly 'linked' widget and changes to the widget will not have...
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