Sphinx can only query against the information it knows about - ie: what's in the index.

So, if you want to query against zip codes, make sure you have a field for that column:

  indexes zip

Keep in mind that string attributes can't be used for filters:
http://freelancing-god.github.com/ts/en/common_issues.html#string_filters

If you want to query by multiple zip codes, then check out the sphinx docs for the extended match mode syntax - you'll want to wrap all zip codes together with parentheses, and separate them with OR pipes:

  Donate.search :conditions => {:zip => "(01234 | 56789)"}

Cheers

--
Pat

On 10/09/2010, at 6:37 PM, Arun <[email protected]> wrote:

Hi Pat,

In the donate model block is
define_index do
    indexes title
 end

On Sep 10, 3:34 pm, Pat Allan <[email protected]> wrote:
Hi Arun

What does the define_index block in your Donate model look like?

-- Pat

On 10/09/2010, at 6:32 PM, Arun <[email protected]> wrote:







thanks i have installed 2.0.0.rc2 and in the filters i am using the
array only.

Even though i perforemd search like this
donate = Donate.search "Stringer", :conditions => {:zip =>91795}
Stringer word is matched with zipcode but result is not retrieving and also i regenerated the index and i restarted the servers also what to
do ?

On Sep 10, 3:16 pm, Pat Allan <[email protected]> wrote:
Hi Arun

What does your define_block look like?Because you can't use string
attributes for filters.

Also, probably best using 2.0.0.rc2 - though that shouldn't change
anything in this situation.

Cheers

--
Pat

On 10/09/2010, at 6:12 PM, Arun <[email protected]> wrote:

Hi friend,
I have installed the "gem 'thinking-sphinx', '2.0.0.rc1', :require
=>
'thinking_sphinx'" in the rails 3 application

Search function is working but Attribute Filters,field condtions is
not working

I need to search donation  name with matched zipcodes only ,so i
used
like this
@donates = Donate.search params[:search],:with_all => {:zip =>
zipcodes.collect(&:zipcode)}

But it is retrieving the result even it not matching also and i
tried
like this in console to check sphinx

Donate.search "Stringer", :conditions => {:zip => '91795'}
zip code belongs to "stringer" but it is also not retrieving

where i am doing wrong??

--
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 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 .


--
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.

Reply via email to