# Thinking Sphinx

**URL:** <https://www.ruby-forum.com/t/thinking-sphinx/167976>\
**Category:** Rails\
**Created:** [May 14, 2009, 4:28pm UTC](https://www.ruby-forum.com/t/thinking-sphinx/167976 "2009-05-14T16:28:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b2d939/32.png) [@raghu](https://www.ruby-forum.com/u/raghu)\
**Post date:** [May 14, 2009, 4:28pm UTC](https://www.ruby-forum.com/t/thinking-sphinx/167976/1 "2009-05-14T16:28:31Z")

</div>

Search criteria  
1.Searching with the combination of the “AND” and “OR” conditions for  
four to five fields of the table.  
-Added the indexes for the search fields.  
Ex1. Order.search(:conditions=\>[“store\_id=16 and  
(store\_order\_id=‘23432’ or store\_customer\_id=‘23432’)” ])  
-This query is returning the empty result set.

Ex2.  
Order.search(:conditions=\>{:store\_id=\>16,:store\_order\_id=\>“23432”,:store\_customer\_id=\>“23432”})  
-This query works perfectly,but this is a combination of the “AND”  
condition.

Trying to find a solution to search on the multiple fields combined with  
“AND” and “OR” conditions.

Regards,  
Raghu
