Hi Diego Your understanding is correct - it is indeed treating '@name' as part of the search terms to match against. You need to switch to the extended or extended2 match mode to have the @-syntax work:
client.match_mode = :extended2 If that doesn't help, or you have further questions, let me know. Cheers -- Pat On 5 Jul 2014, at 2:25 am, Diego Ayuso <[email protected]> wrote: > Hi guys, > > I've been trying and searching for examples to search by field with the > riddle gem directly, I've seen many examples of how to search by this way on > php and I think riddle can do it too. I'll put below my code: > > ## BEGIN ## > client = Riddle::Client.new > client.filters << Riddle::Client::Filter.new('years', 1..10) # > working ok > client.filters << Riddle::Client::Filter.new('user_id', [2]) # > working ok > client.sort_by = "price DESC" > # working ok > client.group_by = "user_id" > # working ok > results = client.query("@name diego", "users") # NOT > WORKING! :( > ### END ### > > So the query is to the index returns the following results: > {:matches=>[], > :fields=>["title", "body"], > :attributes=> > {"user_id"=>1, "title"=>7, "body"=>7, "price"=>5, "created_at"=>2}, > :attribute_names=>["user_id", "title", "body", "price", "created_at"], > :words=> > {"name"=>{:docs=>0, :hits=>0}, > "diego"=>{:docs=>1, :hits=>1}, > > The point is that I think I'm searching by the word name and diego, and NOT > on field name the word "diego". > > Can you give me a hint please. > > Thanks in advance. > > > > > -- > 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. > For more options, visit https://groups.google.com/d/optout. -- 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. For more options, visit https://groups.google.com/d/optout.
