You can use the ThinkingSphinx::Query.wildcard method to wildcard the query or 
any of the conditions as you wish.

  [:alignment, :ethnicity].each do |key|
    condition[key] = ThinkingSphinx::Query.wildcard(params[key]) if 
params[key].present?
  end
  condition[:gender] = params[:gender] if params[:gender].present?

  ThinkingSphinx.search :with => filters, :conditions => condition, ...

The query argument in the search (your s variable) is optional, so if you don't 
have anything, then you don't need to pass it through.

On 22 Mar 2014, at 4:19 am, mamesaye kane <[email protected]> wrote:

> Thanks for the quick reply.
> Actually i want to use the star for some of the conditions but not for gender 
> and i don't need it for s since it is empty.
> Is it possible to have something like:
> 
> 
> s = "" 
> condition[:alignment] = params[:alignment] if params[:alignment].present?     
>  
> condition[:gender] =  params[:gender], :star => true if 
> params[:gender].present?
> condition[:ethnicity] =  params[:ethnicity] if params[:ethnicity].present? 
>  
> @results = ThinkingSphinx.search s, 
>                                 :with     => filters, 
>                                 :conditions =>  condition,  
>                                 :order    => 'model_order ASC ', #order 
> result by model
>                                 :page     => params[:page],
>                                 :per_page => 10000 #144
>  
> 
> 
> -- 
> 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.

Reply via email to