Hi Viren You should definitely be using :with (at the time of Ryan's screencast, Thinking Sphinx allowed for both field and attribute filters in :conditions, but that's no longer the case).
But also, if supplier_id is a string, then you can't filter on it when it's an attribute. Potentially, you would work around it, though it may be worth just making it a field instead: http://freelancing-god.github.com/ts/en/common_issues.html#string_filters As for the difference between fields and attributes - fields are the textual data that you generally expect your website's users to enter, whereas attributes are usually not strings, and are used for internal filters and sorting. There's a bit more of an explanation here: http://freelancing-god.github.com/ts/en/sphinx_basics.html Cheers -- Pat On 24/05/2012, at 11:04 PM, Viren wrote: > If Set up Thinking Sphinx on my application now > > Everything was workinf fine > > Until I decide to do a conditions query with Thinking Sphinx > > PartPriceRecord.search "50002" ,:conditions => { :supplier_id => > "supp50002" },:star => true > > and it reported me with the above error > > ThinkingSphinx::SphinxError: index part_price_record_core: query > error: no field 'supplier_id' found in schema > > seeing even the Ryan Bates Screencast > http://railscasts.com/episodes/120-thinking-sphinx > he seem to achieve the conditions clauses with "has" method defined > for the column > > something like > > has :author_id > > > Reading to one of the post by Pate Allen (scroll down to bottom) > > > https://groups.google.com/group/thinking-sphinx/browse_thread/thread/1dad41c934bfae41/bfe498c6266102b1?lnk=gst&q=+query+error%3A+no+field+#bfe498c6266102b1 > > " :with should be used for attribute filters, and :conditions for > field queries. " > > so changing my above code with clause > > PartPriceRecord.search "PartNumber50002",:with => {:supplier_id => > "supp50002" },:star => true > > and I get no result which is wrong as I can see Record for > "supplier_id" for part_number "PartNumber50002" in by database > > Now I'm confuse > > why is above error appearing and also what the fundamental difference > between "fields" and "attribute" > > can anyone help > > BTW here my indexes definition > > define_index do > indexes part_number > has supplier_id > end > > sphinx_scope(:supplier) { |name| > {:conditions => {:supplier_id => supplier}} > } > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
