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 santosh sidnal <si...@gmail.com> on 2014/04/01 12:55:06 UTC

sort by an attribute values sequence

Hi All,

We have a specific requirement of sorting the products as per a specific
attribute value sequence. Any pointer or source of info would help us.

Example of the scenario;

Let's say for search result i want to sort results based on a attribute
producttype. Where producttype has following values, A, B, C, D.

so while in solr query i can give either producttype asc, producttype desc.

But I want get result in a specific way by saying first give me All results
of values 'C' then B, A, D.


-- 
Regards,
Santosh Sidnal

Re: sort by an attribute values sequence

Posted by Shawn Heisey <so...@elyograg.org>.
On 4/3/2014 12:53 AM, santosh sidnal wrote:
> But my requirement is i want sorting to be applied and boost a
> particular/some attribute values (C,B etc) in the sorted result, which is
> not working. Looks like sorting will take precedence over boosting. Correct
> me if i am wrong.

If you use a sort parameter and that sort does not incorporate 'score'
at all, the relevancy score (and anything you have boosted) is
completely ignored.

https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-ThesortParameter

Depending on exactly what your requirements are, query elevation might work.

https://cwiki.apache.org/confluence/display/solr/The+Query+Elevation+Component

Thanks,
Shawn


Re: sort by an attribute values sequence

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Santosh,

Which field do you sort on? You can multiple sort criteria, like sort=someFied asc, score desc



On Thursday, April 3, 2014 9:54 AM, santosh sidnal <si...@gmail.com> wrote:
Hi Ahmet/All,

Thanks for the reply.

The Solution of boosting those product type values will work fine if i
don't apply any 'sort' .

But my requirement is i want sorting to be applied and boost a
particular/some attribute values (C,B etc) in the sorted result, which is
not working. Looks like sorting will take precedence over boosting. Correct
me if i am wrong.

Also i am trying  functional query, looks like even i will face same
problem over there.

we have more only 4 values for producttype attribute, but for different
keywords we have to use different attributes in sorting and boosting the
result, that we can manage in our application.


Regards,
Santosh


On Wed, Apr 2, 2014 at 8:49 PM, Ahmet Arslan <io...@yahoo.com> wrote:

> Hi,
>
> How many distinct producttype do you have?
>
> May be
>
> q=C^5000 OR B^4000 OR A^3000 OR D&df=producttype
>
> could work.
>
> If you can came up with a function that takes maximum value when
> producttype=C ... etc you can sort by function queries too.
> http://wiki.apache.org/solr/FunctionQuery
>
>
> Ahmet
>
>
> On Wednesday, April 2, 2014 1:52 PM, santosh sidnal <
> sidnal.santosh@gmail.com> wrote:
> Re-sending my e-mail. any pointers/ links for the issue will help me lot.
>
> Thanks in advance.
>
>
> On Tue, Apr 1, 2014 at 4:25 PM, santosh sidnal <sidnal.santosh@gmail.com
> >wrote:
>
> > Hi All,
> >
> > We have a specific requirement of sorting the products as per a specific
> > attribute value sequence. Any pointer or source of info would help us.
> >
> > Example of the scenario;
> >
> > Let's say for search result i want to sort results based on a attribute
> > producttype. Where producttype has following values, A, B, C, D.
> >
> > so while in solr query i can give either producttype asc, producttype
> desc.
> >
> > But I want get result in a specific way by saying first give me All
> > results of values 'C' then B, A, D.
> >
> >
> > --
> > Regards,
> > Santosh Sidnal

>
> >
> >
>
>
> --
> Regards,
> Santosh Sidnal
>
>


-- 
Regards,
Santosh Sidnal


Re: sort by an attribute values sequence

Posted by santosh sidnal <si...@gmail.com>.
Hi Ahmet/All,

Thanks for the reply.

The Solution of boosting those product type values will work fine if i
don't apply any 'sort' .

But my requirement is i want sorting to be applied and boost a
particular/some attribute values (C,B etc) in the sorted result, which is
not working. Looks like sorting will take precedence over boosting. Correct
me if i am wrong.

Also i am trying  functional query, looks like even i will face same
problem over there.

we have more only 4 values for producttype attribute, but for different
keywords we have to use different attributes in sorting and boosting the
result, that we can manage in our application.


Regards,
Santosh


On Wed, Apr 2, 2014 at 8:49 PM, Ahmet Arslan <io...@yahoo.com> wrote:

> Hi,
>
> How many distinct producttype do you have?
>
> May be
>
> q=C^5000 OR B^4000 OR A^3000 OR D&df=producttype
>
> could work.
>
> If you can came up with a function that takes maximum value when
> producttype=C ... etc you can sort by function queries too.
> http://wiki.apache.org/solr/FunctionQuery
>
>
> Ahmet
>
>
> On Wednesday, April 2, 2014 1:52 PM, santosh sidnal <
> sidnal.santosh@gmail.com> wrote:
> Re-sending my e-mail. any pointers/ links for the issue will help me lot.
>
> Thanks in advance.
>
>
> On Tue, Apr 1, 2014 at 4:25 PM, santosh sidnal <sidnal.santosh@gmail.com
> >wrote:
>
> > Hi All,
> >
> > We have a specific requirement of sorting the products as per a specific
> > attribute value sequence. Any pointer or source of info would help us.
> >
> > Example of the scenario;
> >
> > Let's say for search result i want to sort results based on a attribute
> > producttype. Where producttype has following values, A, B, C, D.
> >
> > so while in solr query i can give either producttype asc, producttype
> desc.
> >
> > But I want get result in a specific way by saying first give me All
> > results of values 'C' then B, A, D.
> >
> >
> > --
> > Regards,
> > Santosh Sidnal
>
> >
> >
>
>
> --
> Regards,
> Santosh Sidnal
>
>


-- 
Regards,
Santosh Sidnal

Re: sort by an attribute values sequence

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi,

How many distinct producttype do you have?

May be 

q=C^5000 OR B^4000 OR A^3000 OR D&df=producttype

could work.

If you can came up with a function that takes maximum value when producttype=C … etc you can sort by function queries too.
http://wiki.apache.org/solr/FunctionQuery


Ahmet


On Wednesday, April 2, 2014 1:52 PM, santosh sidnal <si...@gmail.com> wrote:
Re-sending my e-mail. any pointers/ links for the issue will help me lot.

Thanks in advance.


On Tue, Apr 1, 2014 at 4:25 PM, santosh sidnal <si...@gmail.com>wrote:

> Hi All,
>
> We have a specific requirement of sorting the products as per a specific
> attribute value sequence. Any pointer or source of info would help us.
>
> Example of the scenario;
>
> Let's say for search result i want to sort results based on a attribute
> producttype. Where producttype has following values, A, B, C, D.
>
> so while in solr query i can give either producttype asc, producttype desc.
>
> But I want get result in a specific way by saying first give me All
> results of values 'C' then B, A, D.
>
>
> --
> Regards,
> Santosh Sidnal

>
>


-- 
Regards,
Santosh Sidnal


Re: sort by an attribute values sequence

Posted by santosh sidnal <si...@gmail.com>.
Re-sending my e-mail. any pointers/ links for the issue will help me lot.

Thanks in advance.


On Tue, Apr 1, 2014 at 4:25 PM, santosh sidnal <si...@gmail.com>wrote:

> Hi All,
>
> We have a specific requirement of sorting the products as per a specific
> attribute value sequence. Any pointer or source of info would help us.
>
> Example of the scenario;
>
> Let's say for search result i want to sort results based on a attribute
> producttype. Where producttype has following values, A, B, C, D.
>
> so while in solr query i can give either producttype asc, producttype desc.
>
> But I want get result in a specific way by saying first give me All
> results of values 'C' then B, A, D.
>
>
> --
> Regards,
> Santosh Sidnal
>
>


-- 
Regards,
Santosh Sidnal