On 9/22/06, Benjamin Krause <[EMAIL PROTECTED]> wrote:
> 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 ..
>
> BenThis 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. _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

