Sorry, I’m not quite understanding here (but I’m also jetlagged) - I’m not sure 
where the else comes into it? Also not sure why you’re defining @users again, 
right after defining it the first time… is there some context I’m missing?

On 30 Oct 2014, at 3:17 am, C Wilson <[email protected]> wrote:

> I am not receiving any returned results when I do a search query.
> 
>   def index
>     @search = Search.new
>     
>     if location = Location.find_by_zipcode(params[:search])
>         latitude  = location.latitude * Math::PI / 180 
>         longitude = location.longitude * Math::PI / 180 
>         locations = Location.search( 
>           :geo   => [latitude, longitude], 
>           :with  => {:geodist => 0.0..100_000.0}, 
>           :order => 'geodist ASC',
>           :per_page => 5_000
>         ) 
>         @users = User.where(zip_code: locations.map(&:zipcode))
>         @users = User.search(params[:search].gsub(/\s+/, ' | '))
> 
> 
> If I do @users = User.where(zip_code: locations.map(&:zipcode)) else  @users 
> = User.search(params[:search].gsub(/\s+/, ' | ')) then it returns results. 
> Why is it that I have to add `else`? Shouldn't I be able to run both?
> 
> I know in other parts of the app I can have it look like the above and it 
> works as expected. But in this controller using your gem it doesn't.
> 
> -- 
> 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