Search facets count is incorrect when filter is used with a value not only indexed in the facet category #117

Closed
beatrichartz opened this Issue Jul 10, 2013 · 10 comments

Comments

Projects
None yet
2 participants
Contributor

beatrichartz commented Jul 10, 2013

I created a gist here:

https://gist.github.com/beatrichartz/5968572

Essentially, the problem is that the "Black" in "Outdoor Black" leads to the shoe being counted twice in the :color facet count.

picky ftw!

Owner

floere commented Jul 11, 2013

See gist comments. Reopen if needed :)

floere closed this Jul 11, 2013

Contributor

beatrichartz commented Jul 11, 2013

So I think this is more of a feature request then. The thing is that most of the time I use facets, I do not know the category of the already provided query. To illustrate, the usecase is a single input field and then facet filters are provided based on the query the user types into that single field.

Picky "supports" this already by allowing me to put the query string into the filters, and the facets are correct, just the counts are wrong.

Also, if you're really in for it, a nice DSL to provide such facets would be:

results = shoe_search.search("black type:outdoor")
results.facets(:color) #these facets would take the original query string with category filters

at least in my opinion :) Like this a search could provide facets to really dig into results.

I will solve this by doing a second regular query in the meantime and group them manually into the facets I need, reopen this if you're interested to provide this, because I can't :)

floere reopened this Jul 11, 2013

Owner

floere commented Jul 11, 2013

Ok, I'm beginning to understand where you are coming from. And I think you are right – the provided bug report actually shows the problem well.

Owner

floere commented Jul 11, 2013

A top-of-the-head simple solution for now might be to use max_allocations 1 in the shoe_search definition.

Contributor

beatrichartz commented Jul 11, 2013

Great, max_allocations 1 did the trick. From what I understand, this will hurt results / sorting with queries containing multiple words? Looking forward to the complex solution :)

Thanks!

Owner

floere commented Jul 12, 2013

I'll leave this sort-of-open since I like your API idea:

results = shoe_search.search("black type:outdoor")
# these facets would take the original query string with category filters
#
results.facets(:color)

floere closed this Jul 12, 2013

Owner

floere commented Jul 12, 2013

Let me know if it works etc.

Contributor

beatrichartz commented Jul 12, 2013

Wow! This was fast, and it works impeccably! Thanks!

Owner

floere commented Jul 12, 2013

Cheers! :)

On Fri, Jul 12, 2013 at 8:04 PM, Beat notifications@github.com wrote:

Wow! This was fast, and it works impeccably! Thanks!

Reply to this email directly or view it on GitHub:
#117 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment