Facets issue (clicking Brand facet "citizen" still shows records from anything containing "citizen")

12 views
Skip to first unread message

geoffw8

unread,
Sep 10, 2012, 2:14:05 PM9/10/12
to thinkin...@googlegroups.com
Hi Pat,

Sorry if this is double posted, I can't quite work out if the last one I posted went up.

Anyway, the title kind of says it all - we have a setup where I have a Product.search_for(params) method and a Product.facets_for(params) method. Both work out the :conditions using the same method (I just send the params and it does the work). Anyway, we noticed today that if we search for a brand, i.e. :brand => "Nike" then it shows us products from ALL brands containing the word Nike. What we're trying to do ideally is just have it return "Nike", without anything either side.

Is there a simple way for us to do this?

Its weird really, we've managed for a while without it, then we just sort of noticed it.

Thanks,

Geoff

Geoff Wright

unread,
Sep 10, 2012, 2:16:47 PM9/10/12
to thinkin...@googlegroups.com
Just so you know, I've tried a few things. I did take a look at the Advanced Facets section on your sight (as an aside, did you change the URL or something, Googling for your site is pretty much impossible these days) and it I saw the @articles = @facets.for method. That didn't really do what I wanted either, I couldn't really get the facets to represent the @articles accurately, and I'd sooner not rebuild everything anyway, we've built a fair bit of code that handles lots of things, what stores to search from, gender, locale etc etc.

Thanks in advance for your help.

Much appreciated.

Geoff

--
You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/0L5nAMiga8YJ.
To post to this group, send email to thinkin...@googlegroups.com.
To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.



--
BR,

Geoff Wright
Founder & CEO


weartolook LTD
St John's House, 
54 St John's Square, 
London, EC1V4JL

Pat Allan

unread,
Sep 14, 2012, 6:54:52 PM9/14/12
to thinkin...@googlegroups.com
Hi Geoff

Just to confirm: are you using an actual facet for this search, or just searching with conditions on the field in question?

If it's the latter (which is what it sounds like), then the issue is that field searches aren't on the full value of the field - this is Sphinx's normal behaviour. However, you can use regex-ish syntax to mark the start and end of the value - something like the following should hopefully work:

Product.search :conditions => {:brand => "^Nike$"}

(The docs were shifted because I changed GitHub usernames from freelancing-god to pat - but earlier today I published the docs back to freelancing-god.github.com, given I grabbed that username again to direct people to the new locations. So, Google should be happier with that situation. It's a shame GitHub doesn't allow 301 redirects from one account to another).

Cheers

--
Pat

Reply all
Reply to author
Forward
0 new messages