Question

Everything else remaining the same, some of my objects are more valuable than others.

Is it possible to boost objects at index time, let's say according to the USD price?

Or if you have a limited number of values, I was hoping that this would work:

f:aaa^4 f:bbb^3 f:ccc^2 animal:elephant

but I must be missing something.

Was it helpful?

Solution

What you are saying will work. However, you will probably want to reformat it as (boost query) +(original query), e.g. (f:a^4 f:b^3 b:c^2) +animal:elephant. The way you have it now will find things which only have f:aaa, regardless of animal:elephant.

You can see Lucene in Action for an example of how to write a custom scorer which allows you to do somethign more like boosting according to price. I'm not aware of any way you can do this without writing some code though.

OTHER TIPS

If you are using hibernate-search, you can add boosting directly to fields using annotation. There are two type of boost: dynamic boost which apply to the whole object, or field level boost. You probably want dynamic boost, and can be specified using: @DynamicBoost(impl = VIPBoostStrategy.class)

See http://docs.jboss.org/hibernate/search/3.2/reference/en-US/html/search-mapping.html#section-boost-annotation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top