Searching untokenized fields

Hi …

I tried to exclude certain objects from my search, by adding appropriate
term queries …

i = Ferret::Index::Index.new
i.field_infos.add_field(:type, :index => :untokenized, :term_vector =>
:no)
i << {:type => “Movie”, :name => “Indiana” }
i << {:type => “Movie”, :name => “Forrest” }
i << {:type => “People”, :name => “Forrest” }

now searching for forrest should give 2 results…

i.search_each(“forrest”) do end
=> 2

now i would like to exclude the movie, so i tried to do this:

i.search_each(“forrest AND NOT type:movie”) do end
=> 2

i.search_each(“forrest AND NOT type:Movie”) do end
=> 2

So how to exclude objects with a certain untokenized value in it? having
the field tokenized works great …

Ben

On 9/22/06, Benjamin K. [email protected] wrote:

=> 2

So how to exclude objects with a certain untokenized value in it? having
the field tokenized works great …

Ben

This is happening because in this case the QueryParser is downcasing
“Movie”, even though it remained in uppercase in the index. You need
to give the QueryParser a specialized Analyzer that won’t analyze
untokenized fields. This is will be automated in the next version of
Ferret: 0.10.7 for the Index class.

This is happening because in this case the QueryParser is downcasing
“Movie”, even though it remained in uppercase in the index. You need
to give the QueryParser a specialized Analyzer that won’t analyze
untokenized fields. This is will be automated in the next version of
Ferret: 0.10.7 for the Index class.
great… thanks :slight_smile:

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