views:

343

answers:

1

I'll just start with the use case. Say I'm searching for a product with a price of $500. I don't necessarily mind if it costs slightly more, or slightly less, but I want products in that price range to receive a higher overall relevance score.

Is there any way to do this in Solr? The relevance/MoreLikeThis docs I've seen on the site don't seem to have any concept of deviation from a given number.

Related question. I'd like to be able to modify my solr search weighting to achieve these two queries:

"Find similarly priced cameras" and "Find similarly featured cameras"

Looking at the more like this handler, the algorithm used to compute the relevance doesn't look like it exposes any control knobs to the programmer. For the similarly priced cameras for example, I'd like to modify the relevance score so that we increase the relevances of items in the same price bracket, but still maintain a weighting for features. For similarly featured, the this would be reversed. I.E "find similarly featured cameras, but if one costs forty thousand dollars, it is less relevant than a similar camera at my selected price" (it should have more features, but maybe they just put chrome spinners on the lens cap).

+2  A: 

On the solr wiki, you'll see some examples of how you can search by range using the field:[a TO b] syntax.

You would want to couple this with sorting. You could also construct a Solr SearchComponent that could specify a weight for a price range, or a RequestHandler. A request handler is what I was more familiar with. An example 'qf' field might be:

<str name="qf">
    productname=^1.0 price=^2.0 brand=^0.5
</str>

I hope this can get you started.

memnoch_proxy