On Thu, Aug 23, 2007 at 06:22:52PM +0200, Mlynco Mlynco wrote:
[..]
> 
> So, ie I am looking for a recipe. I have indexed some of them with such 
> ingredients:
> 
> recipe1: "beef"
> recipe2: "onion beef chicken"
> recipe3: "onion beef chicken tomato"
> 
> Looking for a "beef" I wouldn't like to "punish" recipe2 and recipe3 
> because they are richer, I would like to treat them in the same way. 
> Actually the score does not have to be 1.0, but I would like it to be 
> the same for all recipes mentioned above.
> 
> Any suggestions?

have a look at ConstantScoreQuery. It allows to turn a Filter into a
query where all results score equally. 

To get this Filter, you could use the QueryFilter class, which allows
you to turn your original query into a Filter.

query = ConstantScoreQuery.new(QueryFilter.new(TermQuery.new(:ingredients, 
'beef'))

looks like there should be an easier way to achieve this, though ;-)

Jens


-- 
Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/     - The new free film database
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to