Different Sorts based on Different Groups

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Different Sorts based on Different Groups

Gustatec
Hello everyone!

I'm currently using Solr in a project (pretty much an e-commerce POC) and came across with the following sort situation:

I have two products one called Product1 and other one called Product2, both of them belongs to the same categories, Shirt(ID 1) and Tank-Top(ID 2)

When i query for any of these categories, it returns both of the products, in the same order.

Is it possible to do some kind of grouping sort in query? So when i query for category Shirt, it returns first Product1 then Product2 and when i do the same query for category Tank-Top it would return first Product2 then Product1?

By asking that i wonder if its possible to make a product more relevant, based on the query.

So product1 relevancy would be
Category ID | Priority
    1       |     1
    2       |     2

And product2 would be
Category ID | Priority
    1       |     2
    2       |     1


Is it possible to achieve this "elevate" funcionality in query?

i thought in doing a <category_name>_sort field  for all categories, but we are actually talking about a few hundred categories, so i dont know if would be viable to create one sort field for each one of them in every single doc...

Ps: I asks if its achievable that in query because i dont know if there is any other way of changing the elevate.xml file without having to restart my solr instance

Sorry for my bad english, and thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: Different Sorts based on Different Groups

Alessandro Benedetti
Hi Gustatec,
your problem seems a fairly basic relevance problem.
Instead of elevating documents, why don't you include the category as part
of the main query ?
To make it simple in Solr you have a query component which affect the score
and the filter queries which don't.

If in your case you add the category as part of the main query, documents
matching that category will be more relevant.
Relevancy is an hard topic, but based on your initial requirement I think
you can solve it quite easily.
If i misunderstood anything , let me know!

Cheers

On Fri, Nov 4, 2016 at 2:51 PM, Gustatec <[hidden email]> wrote:

> Hello everyone!
>
> I'm currently using Solr in a project (pretty much an e-commerce POC) and
> came across with the following sort situation:
>
> I have two products one called Product1 and other one called Product2, both
> of them belongs to the same categories, Shirt(ID 1) and Tank-Top(ID 2)
>
> When i query for any of these categories, it returns both of the products,
> in the same order.
>
> Is it possible to do some kind of grouping sort in query? So when i query
> for category Shirt, it returns first Product1 then Product2 and when i do
> the same query for category Tank-Top it would return first Product2 then
> Product1?
>
> By asking that i wonder if its possible to make a product more relevant,
> based on the query.
>
> So product1 relevancy would be
> Category ID | Priority
>     1       |     1
>     2       |     2
>
> And product2 would be
> Category ID | Priority
>     1       |     2
>     2       |     1
>
>
> Is it possible to achieve this "elevate" funcionality in query?
>
> i thought in doing a <category_name>_sort field  for all categories, but we
> are actually talking about a few hundred categories, so i dont know if
> would
> be viable to create one sort field for each one of them in every single
> doc...
>
> Ps: I asks if its achievable that in query because i dont know if there is
> any other way of changing the elevate.xml file without having to restart my
> solr instance
>
> Sorry for my bad english, and thanks in advance!
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Different-Sorts-based-on-Different-Groups-tp4304516.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



--
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
Reply | Threaded
Open this post in threaded view
|

Re: Different Sorts based on Different Groups

Fuad Efendi
In reply to this post by Gustatec
Hi Gustatec,


Relevancy tuning is really *huge* area, check this book when you have a
chance: https://www.manning.com/books/relevant-search

Default Solr sorting is based on TF/IDF algorithm; and sorting is not
necessarily ‘relevancy’

Trivial solution for clothes store domain would be this one, better to
explain using examples:

Product 1
========
Name: "Russell Athletic Men's Basic Tank Top"
Categories: “Shirt”, “Sleeveless Shirt”, “Tank Top”

Product 2
========
Name: "Russell Athletic Men's Cotton Muscle Shirt"
Categories: “Shirt”, “Sleeveless Shirt”, “Tank Top”


You may notice that first product has “Top” repeated twice in product name
and category; and second one has “Short” repeated twice.

Now having this real-life example you can play with boost query, boosting
results containing words from category name in their product name.

category:”Tank Top” & bq:”name:tank^10 OR name:top^5"


Solr provides “boost query” to tune sorting of output results, check “bq”
parameter in the docs at
https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser


I went from real-life scenario; your scenario and possible solutions could
be very different.

I had recently assignment at well-known retail shop where we even designed
pre-query custom boosts so that we can customize typical (most important
for the business) queries as per business needs



Thanks,

--

Fuad Efendi

(416) 993-2060

http://www.tokenizer.ca
Search Relevancy, Recommender Systems


On November 4, 2016 at 10:57:02 AM, Gustatec ([hidden email]) wrote:

Hello everyone!

I'm currently using Solr in a project (pretty much an e-commerce POC) and
came across with the following sort situation:

I have two products one called Product1 and other one called Product2, both
of them belongs to the same categories, Shirt(ID 1) and Tank-Top(ID 2)

When i query for any of these categories, it returns both of the products,
in the same order.

Is it possible to do some kind of grouping sort in query? So when i query
for category Shirt, it returns first Product1 then Product2 and when i do
the same query for category Tank-Top it would return first Product2 then
Product1?

By asking that i wonder if its possible to make a product more relevant,
based on the query.

So product1 relevancy would be
Category ID | Priority
1 | 1
2 | 2

And product2 would be
Category ID | Priority
1 | 2
2 | 1


Is it possible to achieve this "elevate" funcionality in query?

i thought in doing a <category_name>_sort field for all categories, but we
are actually talking about a few hundred categories, so i dont know if
would
be viable to create one sort field for each one of them in every single
doc...

Ps: I asks if its achievable that in query because i dont know if there is
any other way of changing the elevate.xml file without having to restart my
solr instance

Sorry for my bad english, and thanks in advance!



--
View this message in context:
http://lucene.472066.n3.nabble.com/Different-Sorts-based-on-Different-Groups-tp4304516.html
Sent from the Solr - User mailing list archive at Nabble.com.