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 Raju444us <gu...@gmail.com> on 2009/04/30 00:07:30 UTC

Facet counts for common terms of the searched field

I have a requirement. If I search for text field let's say "metal:glass" what
i want is to get the facet counts for all the terms related to "glass" in my
search results.

window(100)  since a window can be glass.
plastic(10)  plastic is a material just like glass
Iron(10)
Paper(15)

Can I use MLT to get this functionality.Please let me know how can I achieve
this.If possible an example query.

Thanks,
Raju
-- 
View this message in context: http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23302410.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Facet counts for common terms of the searched field

Posted by Matt Weber <ma...@mattweber.org>.
I mean you can sort the facet results by frequency, which happens to  
be the default behavior.

Here is an example field for your schema:

<field name="textfieldfacet" type="string" indexed="true"  
stored="true" multiValued="true" />

Here is an example query:

http://localhost:8983/solr/select?q=textfield:copper&facet=true&facet.field=textfieldfacet&facet.limit=5

This will give you the top 5 words in the textfieldfacet.

Thanks,

Matt Weber
eSr Technologies
http://www.esr-technologies.com




On May 12, 2009, at 7:57 AM, sachin78 wrote:

>
> Thanks Matt for your reply.
>
> What do you mean by frequency(the default)?
>
> Can you please provide an example schema and query will look like.
>
> --Sachin
>
>
> Matt Weber-2 wrote:
>>
>> You may have to take care of this at index time.  You can create a  
>> new
>> multivalued field that has minimal processing.  Then at index time,
>> index the full contents of textfield as normal, but then also split  
>> it
>> on whitespace and index each word in the new field you just created.
>> Now you will be able to facet on this new field and sort the facet by
>> frequency (the default) to get the most popular words.
>>
>> Thanks,
>>
>> Matt Weber
>> eSr Technologies
>> http://www.esr-technologies.com
>>
>>
>>
>>
>> On May 12, 2009, at 7:33 AM, sachin78 wrote:
>>
>>>
>>> Does anybody have answer to this post.I have a similar requirement.
>>>
>>> Suppose I have free text field say
>>> I index the field.If I search for textfield:copper.I have to get  
>>> facet
>>> counts for the most common words found in a textfield.
>>> ie.
>>>
>>> example:search for textfield:glass
>>> should return facet counts for common words found textfield.
>>> semiconductor(10),iron(20), silicon (25) material (8) thin(25) and
>>> so on.
>>> Can this be done using tagging or MLT.
>>>
>>> Thanks,
>>> Sachin
>>>
>>>
>>> Raju444us wrote:
>>>>
>>>> I have a requirement. If I search for text field let's say
>>>> "metal:glass"
>>>> what i want is to get the facet counts for all the terms related to
>>>> "glass" in my search results.
>>>>
>>>> window(100)  since a window can be glass.
>>>> plastic(10)  plastic is a material just like glass
>>>> Iron(10)
>>>> Paper(15)
>>>>
>>>> Can I use MLT to get this functionality.Please let me know how  
>>>> can I
>>>> achieve this.If possible an example query.
>>>>
>>>> Thanks,
>>>> Raju
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23503794.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23504241.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Facet counts for common terms of the searched field

Posted by sachin78 <te...@gmail.com>.
Thanks Matt for your reply.

What do you mean by frequency(the default)?

Can you please provide an example schema and query will look like.

--Sachin


Matt Weber-2 wrote:
> 
> You may have to take care of this at index time.  You can create a new  
> multivalued field that has minimal processing.  Then at index time,  
> index the full contents of textfield as normal, but then also split it  
> on whitespace and index each word in the new field you just created.   
> Now you will be able to facet on this new field and sort the facet by  
> frequency (the default) to get the most popular words.
> 
> Thanks,
> 
> Matt Weber
> eSr Technologies
> http://www.esr-technologies.com
> 
> 
> 
> 
> On May 12, 2009, at 7:33 AM, sachin78 wrote:
> 
>>
>> Does anybody have answer to this post.I have a similar requirement.
>>
>> Suppose I have free text field say
>> I index the field.If I search for textfield:copper.I have to get facet
>> counts for the most common words found in a textfield.
>> ie.
>>
>> example:search for textfield:glass
>> should return facet counts for common words found textfield.
>> semiconductor(10),iron(20), silicon (25) material (8) thin(25) and  
>> so on.
>> Can this be done using tagging or MLT.
>>
>> Thanks,
>> Sachin
>>
>>
>> Raju444us wrote:
>>>
>>> I have a requirement. If I search for text field let's say  
>>> "metal:glass"
>>> what i want is to get the facet counts for all the terms related to
>>> "glass" in my search results.
>>>
>>> window(100)  since a window can be glass.
>>> plastic(10)  plastic is a material just like glass
>>> Iron(10)
>>> Paper(15)
>>>
>>> Can I use MLT to get this functionality.Please let me know how can I
>>> achieve this.If possible an example query.
>>>
>>> Thanks,
>>> Raju
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23503794.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23504241.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Facet counts for common terms of the searched field

Posted by Matt Weber <ma...@mattweber.org>.
You may have to take care of this at index time.  You can create a new  
multivalued field that has minimal processing.  Then at index time,  
index the full contents of textfield as normal, but then also split it  
on whitespace and index each word in the new field you just created.   
Now you will be able to facet on this new field and sort the facet by  
frequency (the default) to get the most popular words.

Thanks,

Matt Weber
eSr Technologies
http://www.esr-technologies.com




On May 12, 2009, at 7:33 AM, sachin78 wrote:

>
> Does anybody have answer to this post.I have a similar requirement.
>
> Suppose I have free text field say
> I index the field.If I search for textfield:copper.I have to get facet
> counts for the most common words found in a textfield.
> ie.
>
> example:search for textfield:glass
> should return facet counts for common words found textfield.
> semiconductor(10),iron(20), silicon (25) material (8) thin(25) and  
> so on.
> Can this be done using tagging or MLT.
>
> Thanks,
> Sachin
>
>
> Raju444us wrote:
>>
>> I have a requirement. If I search for text field let's say  
>> "metal:glass"
>> what i want is to get the facet counts for all the terms related to
>> "glass" in my search results.
>>
>> window(100)  since a window can be glass.
>> plastic(10)  plastic is a material just like glass
>> Iron(10)
>> Paper(15)
>>
>> Can I use MLT to get this functionality.Please let me know how can I
>> achieve this.If possible an example query.
>>
>> Thanks,
>> Raju
>>
>
> -- 
> View this message in context: http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23503794.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Facet counts for common terms of the searched field

Posted by sachin78 <te...@gmail.com>.
Does anybody have answer to this post.I have a similar requirement.

Suppose I have free text field say
I index the field.If I search for textfield:copper.I have to get facet
counts for the most common words found in a textfield.
ie.

example:search for textfield:glass
should return facet counts for common words found textfield.
semiconductor(10),iron(20), silicon (25) material (8) thin(25) and so on.
Can this be done using tagging or MLT.

Thanks,
Sachin


Raju444us wrote:
> 
> I have a requirement. If I search for text field let's say "metal:glass"
> what i want is to get the facet counts for all the terms related to
> "glass" in my search results.
> 
> window(100)  since a window can be glass.
> plastic(10)  plastic is a material just like glass
> Iron(10)
> Paper(15)
> 
> Can I use MLT to get this functionality.Please let me know how can I
> achieve this.If possible an example query.
> 
> Thanks,
> Raju
> 

-- 
View this message in context: http://www.nabble.com/Facet-counts-for-common-terms-of-the-searched-field-tp23302410p23503794.html
Sent from the Solr - User mailing list archive at Nabble.com.