Can't search for OR (as in the state)

I’m trying to search a Model by the state field using Acts As Ferret.
The query for this is ‘+state:NY’ (substitute state abbreviation for
NY). This works find however ‘+state:OR’ returns nothing, though just
‘portland’ will pull up matches within that state.

I’m pretty sure it’s reading OR as an or conditional instead of a state.
Anyway to escape it to fix this issue?

On 03.08.2007, at 17:12, Joe S. wrote:

I’m trying to search a Model by the state field using Acts As Ferret.
The query for this is ‘+state:NY’ (substitute state abbreviation for
NY). This works find however ‘+state:OR’ returns nothing, though just
‘portland’ will pull up matches within that state.

Ferret::Analysis::FULL_ENGLISH_STOP_WORDS.include?(‘or’)
=> true

I’m pretty sure it’s reading OR as an or conditional instead of a
state.
Anyway to escape it to fix this issue?

Index the state field untokenized:

field_infos.add_field(:state, :index => :untokenized, …)

Cheers,
Andy

Andreas K. wrote:

Ferret::Analysis::FULL_ENGLISH_STOP_WORDS.include?(‘or’)
=> true

Index the state field untokenized:

field_infos.add_field(:state, :index => :untokenized, …)

Hi, I am a novice in rails. I too ran in to the same issue.
I did follow your method but am a bit confused…
My model has

acts_as_ferret :fields => {
:description => {:store => :yes},
:state => {:index => :untokenized}},
#:store_class_name => :true,
:remote => false
and in my controller I search with this

condition = “state:(#{params[:state]})”
query = condition + “some_text”

I do not understand where should I use the line code

Ferret::Analysis::FULL_ENGLISH_STOP_WORDS.include?(‘or’)=> true
I am unable to get the desired result when ‘OR’ is passed as a state.
Can you kindly be patient and explain me what am I missing?

Any help would be highly appreciated.

Cheers,
Vinay

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs