ranking on Multivalued fields

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

ranking on Multivalued fields

Umar Shah
Hi,

I have a problem where i want to rank multivalued fields

suppose a multivalued field "category" having associated subfield "score".
First Is it possible to have a subfield in the mutlivalued field?
Second I want to get the documents ranked with the highest score say for the
category:X

thanks
Umar Shah
Reply | Threaded
Open this post in threaded view
|

Re: ranking on Multivalued fields

Otis Gospodnetic-2
Umar,

I'm not sure what you mean by a "subfield", can you explain please?
 
As for your second question, just add category:X to your query and you'll get matches ordered/ranked by score by default.

Otis

--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----
From: Umar Shah <[hidden email]>
To: [hidden email]
Sent: Friday, March 7, 2008 1:17:35 AM
Subject: ranking on Multivalued fields

Hi,

I have a problem where i want to rank multivalued fields

suppose a multivalued field "category" having associated subfield "score".
First Is it possible to have a subfield in the mutlivalued field?
Second I want to get the documents ranked with the highest score say for the
category:X

thanks
Umar Shah



Reply | Threaded
Open this post in threaded view
|

Re: ranking on Multivalued fields

Umar Shah
Hi Otis,

thanks for the reply,

consider a multivalued field name cat
<doc>
--other fields

<field name=cat> val 1 <field name="catrank> score1 </field> </field>
<field name=cat> val 2 <field name="catrank> score2 </field> </field>
<field name=cat> val 3 <field name="catrank> score3 </field> </field>
......

--other fields

<doc>

the query i have to use is
q= cat:query-text; sort catrank desc

get all the documents
WITH field  cat HAVING  query-text
AND order by catrank desc

On 3/8/08, Otis Gospodnetic <[hidden email]> wrote:

>
> Umar,
>
> I'm not sure what you mean by a "subfield", can you explain please?
>
> As for your second question, just add category:X to your query and you'll
> get matches ordered/ranked by score by default.
>
> Otis
>
>
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
> ----- Original Message ----
> From: Umar Shah <[hidden email]>
> To: [hidden email]
> Sent: Friday, March 7, 2008 1:17:35 AM
> Subject: ranking on Multivalued fields
>
> Hi,
>
> I have a problem where i want to rank multivalued fields
>
> suppose a multivalued field "category" having associated subfield "score".
> First Is it possible to have a subfield in the mutlivalued field?
> Second I want to get the documents ranked with the highest score say for
> the
> category:X
>
> thanks
> Umar Shah
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ranking on Multivalued fields

Tobias Lohr
What you probably want to achieve is displaying only docs in a certain
category (maybe filtered) ordered by descending score in the context of
exactly this category, right?

Well, you could come over this by creating a category specific score
field for every category following the schema "cat-X-score" where X is
the identifier of each of your categories. Then when receiving a request
for your category you programmatically have to build the sort-by
condition for field "cat-Y-score", where Y is the category id of the
category you received the request for.

*tobi*

Umar Shah wrote:

> Hi Otis,
>
> thanks for the reply,
>
> consider a multivalued field name cat
> <doc>
> --other fields
>
> <field name=cat> val 1 <field name="catrank> score1 </field> </field>
> <field name=cat> val 2 <field name="catrank> score2 </field> </field>
> <field name=cat> val 3 <field name="catrank> score3 </field> </field>
> ......
>
> --other fields
>
> <doc>
>
> the query i have to use is
> q= cat:query-text; sort catrank desc
>
> get all the documents
> WITH field  cat HAVING  query-text
> AND order by catrank desc
>
> On 3/8/08, Otis Gospodnetic <[hidden email]> wrote:
>  
>> Umar,
>>
>> I'm not sure what you mean by a "subfield", can you explain please?
>>
>> As for your second question, just add category:X to your query and you'll
>> get matches ordered/ranked by score by default.
>>
>> Otis
>>
>>
>> --
>> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>>
>>
>> ----- Original Message ----
>> From: Umar Shah <[hidden email]>
>> To: [hidden email]
>> Sent: Friday, March 7, 2008 1:17:35 AM
>> Subject: ranking on Multivalued fields
>>
>> Hi,
>>
>> I have a problem where i want to rank multivalued fields
>>
>> suppose a multivalued field "category" having associated subfield "score".
>> First Is it possible to have a subfield in the mutlivalued field?
>> Second I want to get the documents ranked with the highest score say for
>> the
>> category:X
>>
>> thanks
>> Umar Shah
>>
>>
>>
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: ranking on Multivalued fields

Otis Gospodnetic-2
In reply to this post by Umar Shah
Umar,

The notion of "subfield" does not exist in Solr (or am I living under a rock?).
Thus, <field name=cat> val 1 <field name="catrank> score1 </field> </field> doesn't really make sense.

Keep those two (cat and catrank) as two distinct fields and I think you'll have what you are after.

Otis

--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----
From: Umar Shah <[hidden email]>
To: [hidden email]
Sent: Saturday, March 8, 2008 7:03:32 AM
Subject: Re: ranking on Multivalued fields

Hi Otis,

thanks for the reply,

consider a multivalued field name cat
<doc>
--other fields

<field name=cat> val 1 <field name="catrank> score1 </field> </field>
<field name=cat> val 2 <field name="catrank> score2 </field> </field>
<field name=cat> val 3 <field name="catrank> score3 </field> </field>
......

--other fields

<doc>

the query i have to use is
q= cat:query-text; sort catrank desc

get all the documents
WITH field  cat HAVING  query-text
AND order by catrank desc

On 3/8/08, Otis Gospodnetic <[hidden email]> wrote:

>
> Umar,
>
> I'm not sure what you mean by a "subfield", can you explain please?
>
> As for your second question, just add category:X to your query and you'll
> get matches ordered/ranked by score by default.
>
> Otis
>
>
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
> ----- Original Message ----
> From: Umar Shah <[hidden email]>
> To: [hidden email]
> Sent: Friday, March 7, 2008 1:17:35 AM
> Subject: ranking on Multivalued fields
>
> Hi,
>
> I have a problem where i want to rank multivalued fields
>
> suppose a multivalued field "category" having associated subfield "score".
> First Is it possible to have a subfield in the mutlivalued field?
> Second I want to get the documents ranked with the highest score say for
> the
> category:X
>
> thanks
> Umar Shah
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: ranking on Multivalued fields

Umar Shah
Thanks Otis,

I am a first time user of SOLR. I understood that my problem calls for a
redesign of the document structure. However using CatX and Cat-X-Score is
not simple because cat is not fixed set, number of values x can take is not
predetermined. However I think dynamic fields might be helpful. If you have
any insights please share.

thanks again.

umar

On 3/12/08, Otis Gospodnetic <[hidden email]> wrote:

>
> Umar,
>
> The notion of "subfield" does not exist in Solr (or am I living under a
> rock?).
> Thus, <field name=cat> val 1 <field name="catrank> score1 </field>
> </field> doesn't really make sense.
>
> Keep those two (cat and catrank) as two distinct fields and I think you'll
> have what you are after.
>
>
> Otis
>
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
> ----- Original Message ----
> From: Umar Shah <[hidden email]>
> To: [hidden email]
>
> Sent: Saturday, March 8, 2008 7:03:32 AM
> Subject: Re: ranking on Multivalued fields
>
> Hi Otis,
>
> thanks for the reply,
>
> consider a multivalued field name cat
> <doc>
> --other fields
>
> <field name=cat> val 1 <field name="catrank> score1 </field> </field>
> <field name=cat> val 2 <field name="catrank> score2 </field> </field>
> <field name=cat> val 3 <field name="catrank> score3 </field> </field>
> ......
>
> --other fields
>
> <doc>
>
> the query i have to use is
> q= cat:query-text; sort catrank desc
>
> get all the documents
> WITH field  cat HAVING  query-text
> AND order by catrank desc
>
> On 3/8/08, Otis Gospodnetic <[hidden email]> wrote:
> >
> > Umar,
> >
> > I'm not sure what you mean by a "subfield", can you explain please?
> >
> > As for your second question, just add category:X to your query and
> you'll
> > get matches ordered/ranked by score by default.
> >
> > Otis
> >
> >
> > --
> > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> >
> >
> > ----- Original Message ----
> > From: Umar Shah <[hidden email]>
> > To: [hidden email]
> > Sent: Friday, March 7, 2008 1:17:35 AM
> > Subject: ranking on Multivalued fields
> >
> > Hi,
> >
> > I have a problem where i want to rank multivalued fields
> >
> > suppose a multivalued field "category" having associated subfield
> "score".
> > First Is it possible to have a subfield in the mutlivalued field?
> > Second I want to get the documents ranked with the highest score say for
> > the
> > category:X
> >
> > thanks
> > Umar Shah
> >
> >
> >
> >
>
>
>
>