location(params[:locations]) returns the value of the checkbox which
is an ID of the data
I did rake ts:stop and rebuld the sphinx also
and one thing that i ran this command in my rails console also
irb(main):004:0> @nonprofits = NonProfit.search "",:with =>
{:county_id => 2}
=> []
irb(main):005:0>
though i have the fields related to county id in my database
----
On Oct 1, 7:11 pm, Pat Allan <[email protected]> wrote:
> Can you give us an example of what location(params[:locations]) returns?
>
> Also, can you run ts:stop, and then confirm there are no other searchd
> instances running, and then run ts:rebuild? Sometimes nil results are
> obtained because there's a different Sphinx instance running that's looking
> at other index files, hence the mismatch.
>
> Cheers
>
> --
> Pat
>
> On 01/10/2010, at 6:42 PM, thunderz14enator wrote:
>
> > Hi,
>
> > I have a secnario where i m searching the result on the basis of
> > checkbox,when i check the particual check box it passes an id called
> > as "county_id", no i have county_id in my database and when i m trying
> > to search the data according to "county_id", its gives me a nil
> > result ,though i have data with that particular county id ..
>
> > the steps i follwoed are
>
> > 1 created a filed in my table naming county id.
>
> > 2 in my model i added these lines
>
> > define_index do
> > indexes nonprofit_name
> > indexes city
> > has county_id
> > # has city
> > set_property :delta => true
> > set_property :enable_star => true
> > set_property :min_prefix_len => 1
> > end
>
> > 3 in my controller
>
> > def nonprofit_sort
> > if !params[:locations].blank? && !params[:search].blank?
> > �...@nonprofits = NonProfit.search params[:search],:with =>
> > {:county_id=> location(params[:locations])},:star => true
>
> > elsif !params[:locations].blank?
>
> > �...@nonprofits = NonProfit.search params[:search],:with =>
> > {:county_id => location(params[:locations])},:star => truep "finished
> > search"
> > elsif !params[:search].blank?
>
> > �...@nonprofits = NonProfit.search params[:search],:star => true
> > else
> > �...@nonprofits= NonProfit.search params[:search],:star => true
> > end
> > end
>
> > 4. Rebuilded the index
>
> > I m totally clueless about getting the nill result
>
> > --
> > 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.