You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Snubbel <So...@spamgourmet.com> on 2013/09/26 14:01:36 UTC
Sorting dependent on user preferences with FunctionQuery
Hello,
I want to present to different user groups a search result in different
orders.
Say, i have customer group A, which I know prefers Books, I want to get
Books at the top of my query result, DVDs at the bottom.
And for group B, preferring DVD, these first.
In my index I have a field of type text named "category" with values Book
and DVD.
I thought maybe I could solve this with QueryFunctions, maybe like this:
select?q=*%3A*&sort=query(qf=category v='Book')desc
but Solr returns "Can't determine a Sort Order (asc or desc) in sort".
What is wrong? I tried different ways of formulating the query without
success...
Or, does anyone have a better idea how to solve this?
Best regards, Nikola
--
View this message in context: http://lucene.472066.n3.nabble.com/Sorting-dependent-on-user-preferences-with-FunctionQuery-tp4092119.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Sorting dependent on user preferences with FunctionQuery
Posted by Chris Hostetter <ho...@fucit.org>.
: select?q=*%3A*&sort=query(qf=category v='Book')desc
:
: but Solr returns "Can't determine a Sort Order (asc or desc) in sort".
the root cause of that error is that you don't have any whitespace between
your query function and "desc"
as for your broader goal: doing a straight sort on the users pref is
probably not the best idea -- it's better to incorporate user prefrnces
into boosting functions so you still retain the benefits of the relevancy
score based on what the user searched for --- even if you know someone
generally buys a lot of books, if they search for "the beatles white
album" you probably don't want all the books that mention the white album,
even just tangentially, to appear before the album itself.
I did a talk last year on "boosting & biasing" that introduces a lot of
hte concepts to think about and the basics of how to appoach problems like
this in solr...
https://people.apache.org/~hossman/ac2012eu/
http://vimeopro.com/user11514798/apache-lucene-eurocon-2012/video/55822630
-Hoss
Re: Sorting dependent on user preferences with FunctionQuery
Posted by Snubbel <So...@spamgourmet.com>.
Hello,
thanks for your answers.
I checked your suggestions, but I'm not quite there yet.
With field collapsing, I only get the top result per category, which is not
what I want, I want to have all results!
And boosting is quite an interesting idea. With the following I get what I
need, all results but Books at the top:
q=+*:* category:Book^2.2&q.op=OR
Unfortunatly, our basic operator is AND. I'm not sure if our customers are
ok whith the results if we change that.
How can I do it with AND?
Best regards, Nikola
--
View this message in context: http://lucene.472066.n3.nabble.com/Sorting-dependent-on-user-preferences-with-FunctionQuery-tp4092119p4092912.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Sorting dependent on user preferences with FunctionQuery
Posted by Erick Erickson <er...@gmail.com>.
You could also group by this field (aka "field collapsing") then
have the front end put whichever group first you wanted.
Best,
Erick
On Thu, Sep 26, 2013 at 9:41 AM, Ing. Jorge Luis Betancourt Gonzalez
<jl...@uci.cu> wrote:
> I think you could use boosting queries: for group A you boost one category and for group B some other category.
>
> ----- Mensaje original -----
> De: "Snubbel" <So...@spamgourmet.com>
> Para: solr-user@lucene.apache.org
> Enviados: Jueves, 26 de Septiembre 2013 8:01:36
> Asunto: Sorting dependent on user preferences with FunctionQuery
>
> Hello,
>
> I want to present to different user groups a search result in different
> orders.
> Say, i have customer group A, which I know prefers Books, I want to get
> Books at the top of my query result, DVDs at the bottom.
> And for group B, preferring DVD, these first.
> In my index I have a field of type text named "category" with values Book
> and DVD.
>
> I thought maybe I could solve this with QueryFunctions, maybe like this:
>
>
> select?q=*%3A*&sort=query(qf=category v='Book')desc
>
> but Solr returns "Can't determine a Sort Order (asc or desc) in sort".
>
> What is wrong? I tried different ways of formulating the query without
> success...
>
>
> Or, does anyone have a better idea how to solve this?
>
> Best regards, Nikola
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Sorting-dependent-on-user-preferences-with-FunctionQuery-tp4092119.html
> Sent from the Solr - User mailing list archive at Nabble.com.
> ________________________________________________________________________________________________
> III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu
> ________________________________________________________________________________________________
> III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu
Re: Sorting dependent on user preferences with FunctionQuery
Posted by "Ing. Jorge Luis Betancourt Gonzalez" <jl...@uci.cu>.
I think you could use boosting queries: for group A you boost one category and for group B some other category.
----- Mensaje original -----
De: "Snubbel" <So...@spamgourmet.com>
Para: solr-user@lucene.apache.org
Enviados: Jueves, 26 de Septiembre 2013 8:01:36
Asunto: Sorting dependent on user preferences with FunctionQuery
Hello,
I want to present to different user groups a search result in different
orders.
Say, i have customer group A, which I know prefers Books, I want to get
Books at the top of my query result, DVDs at the bottom.
And for group B, preferring DVD, these first.
In my index I have a field of type text named "category" with values Book
and DVD.
I thought maybe I could solve this with QueryFunctions, maybe like this:
select?q=*%3A*&sort=query(qf=category v='Book')desc
but Solr returns "Can't determine a Sort Order (asc or desc) in sort".
What is wrong? I tried different ways of formulating the query without
success...
Or, does anyone have a better idea how to solve this?
Best regards, Nikola
--
View this message in context: http://lucene.472066.n3.nabble.com/Sorting-dependent-on-user-preferences-with-FunctionQuery-tp4092119.html
Sent from the Solr - User mailing list archive at Nabble.com.
________________________________________________________________________________________________
III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu
________________________________________________________________________________________________
III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu