hi pat, Thank you for your suggestion. It worked very well after changing the syntax as you suggested! I have another question regarding performance. Each sphinx query is taking an average of 1.5 seconds to complete. Is there any performance tuning guideline/parameters in sphinx ? I could not find one in the sphinx documentation. I have about 10 Million rows in the DB and my index size is 2.5gb. (db size is 5gb. )
regards madhu On Jan 21, 10:41 pm, Pat Allan <[email protected]> wrote: > Hi Madhu > > For these kinds of queries, you will need to use the extended match mode - > although this is implicit when you use :conditions... though for the logic > you want, that isn't really an option, because you want matches in either > field_1 *or* field_2 and field_5. > > It's also worth noting that ANDs are implicit in Sphinx, and OR's are pipes. > So maybe the following will work: > > Article.search "(@field_1 word1 word2) | (@field_2 (word3 | word4) @field_5 > (word5 | word6))", :match_mode => :extended > > And yes, you will need to escape @'s in your query words using \'s. > > Have a look at Sphinx's extended matching docs for more > examples:http://www.sphinxsearch.com/docs/manual-0.9.9.html#extended-syntax > > Cheers > > -- > Pat > > On 22/01/2010, at 7:00 AM, madhu wrote: > > > i am new to TS and just planning to shift from ferret to sphinx for > >performancereason. One thing i like about aaf+ferret is, its powerful > > query language. > > > Is it possible to pass 'native sphinx queries' as is in TS instead of > > constructing it using ':conditons' or ':with'. I am not able to > > construct the query from TS otherwise. > > > This is the pseudo query i want to construct : > > select everthing from my_table where ((( field_1 contains "word1 AND > > word2") OR (field_2 contains "word3 OR word4")) AND (field_5 contails > > "word5 OR word6")) AND status = "active" > > > writing this format doesn't seems to be working : > > > Article.search '((@field_1 word1 AND word2) OR (@field_2 word3 OR > > word4) AND (@field_5 word5 OR word6)) AND @status active' > > > also what if, any of search strings are "@word2" is 'word2' will > > escaping work ? that is '\...@word2' ? > > > appreciate your help > > > tx > > madhu > > > -- > > 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 > > athttp://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.
