Hi Geoff, I've run into the "not getting any results in console" problem a few times. It's usually due to not having :match_mode => :extended. You might want to try that.
-Timo On Thu, Mar 21, 2013 at 12:42 PM, geoffw8 <[email protected]> wrote: > Hi all, > > We have a page on our site that says "pull in all products that belongs to > one of the users favorite brands/stores" > > The way I do that is using something like this: Product.search "(@brand > ('Lacoste' | 'G-SHOCK' | 'Ray-Ban' | 'Barbour')) | @store ('Urban > Outfitters')" > > Now in the controller, that works perfectly. It pulls in all the products > from the relevant brands/stores, I've tested that and it definitely works, > that query there is actually much smaller compared, I have in reality about > 20 brands/stores. > > The problems: > - I can't run that exact query in the console, I get no results > - In the controller, if I do Product.facets "(@brand ('Lacoste' | 'G-SHOCK' > | 'Ray-Ban' | 'Barbour')) | @store ('Urban Outfitters')" I get NO results > (this is how this problem originally arose its head > > Does this query look right? Is everything in the right place? > > My define_index block is: > > # Sphinx index configuration > define_index do > indexes name, :as => "name", :type => "string" > indexes description, :as => "description", :type => > "string" > indexes brand, :facet => true > indexes feed.name, :as => :store, :type => :string, > :facet => true > indexes cost_id, :type => :integer, :facet => true, > :as => "cost" > indexes category.name, :type => :string, :facet => true, > :as => "category" > indexes subcategory.name, :type => :string, :facet => true, > :as => "subcategory" > has feed.shopping_locale_id, :type => :integer, :as => > "store_locale" > has :feed_log_id, :type => :integer, :as => "log" > has :brand_id, :type => :integer > has :image_attempts, :type => :integer > has :is_duplicate, :type => :integer, :as => > "is_duplicate" > has :get_photo_status, :type => :integer > has :gender_id, :as => "gender" > has :sale, :type => :boolean > has :price, :type => :float > has :created_at, :as => "created_at", :type => > :datetime > has :updated_at, :as => "updated_at", :type => > :datetime > has :sale_on, :as => "sale_on", :type => > :datetime > has :last_checked, :as => "last_checked", :type => > :datetime > has :feed_id, :type => :integer > end > > Its really odd, I have looked through the docs a couple of times and it does > say that facets take the same options as search, so I was hoping that query > would work. > > Separately, I notice you can do @facets.for to get the actual records from > active record, am I right in saying its not possible to do @products.facets > to get the facets from an Active Record collection? > > Thanks everyone for your help > > Cheers, > > Geoff > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/thinking-sphinx?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
