Dynamic ranking depending on value of multiple field

Hello,

i've been trying for hours now but i can't come up with a good solution for
the problem. Seems like nobody has had a similiar problem yet:

I have a large database of products and i have a database of product_tags.

{'id_item' => 1, 'title' => 'PS3 Game A', 'tags' => {{'tag' => 'ps3',
'boost' => 3}, {'tag' => 'xbox', 'boost' => 2}}
{'id_item' => 2, 'title' => 'PS3 Game B', 'tags' => {{'tag' => 'ps3',
'boost' => 2}, {'tag' => 'xbox', 'boost' => 3}}

What's supposed to happen is, when somebody searches for ps3 i want the
id_item=1 item to be boosted higher that the second, for xbox the id_item=2
should be boosted stronger.
So i looked at boosting, parent/child, objects but i think nothing really
fulfills my needs. Has anybody an idea of handling this?

Thanks a lot!

--

I can see a couple of options:

  • Denormalize your data even more so each document in ES consists of the
    data for a single tag. This would mean your id_item and title would be
    repeated (potentially a lot if you have a lot of tags) but you could then
    have the boost for the document be the boost for the tag. There could be
    issues of repetition of results but you might be able to get around that,
    depending in your requirements.
  • Use a custom_score query with a script to implement your more complex
    scoring.

On Saturday, August 11, 2012 9:45:06 PM UTC+12, fabik wrote:

Hello,

i've been trying for hours now but i can't come up with a good solution
for the problem. Seems like nobody has had a similiar problem yet:

I have a large database of products and i have a database of product_tags.

{'id_item' => 1, 'title' => 'PS3 Game A', 'tags' => {{'tag' => 'ps3',
'boost' => 3}, {'tag' => 'xbox', 'boost' => 2}}
{'id_item' => 2, 'title' => 'PS3 Game B', 'tags' => {{'tag' => 'ps3',
'boost' => 2}, {'tag' => 'xbox', 'boost' => 3}}

What's supposed to happen is, when somebody searches for ps3 i want the
id_item=1 item to be boosted higher that the second, for xbox the id_item=2
should be boosted stronger.
So i looked at boosting, parent/child, objects but i think nothing really
fulfills my needs. Has anybody an idea of handling this?

Thanks a lot!

--