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 Thiago <th...@gmail.com> on 2012/04/09 22:02:13 UTC

How to facet data from a multivalued field?

Hello everybody,

I've already searched about this topic in the forum, but I didn't find any
case like this. I ask for apologizes if this topic have been already
discussed.

I'm having a problem in faceting a multivalued field. My field is called
series, and it has names of TV series like the big bang theory, two and a
half men ...

In this field I can have a lot of TV series names. For example:

<arr name="series">
       <str>Two and a Half Men</str>
       <str>How I Met Your Mother</str>
       <str>The Big Bang Theory</str>
</arr>

What I want to do is: search and count how many documents related to each
series. I'm doing it using facet search in this field. But it's returning
each word separately. Like this:

<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="series">
           <int name="bang">91</int>
           <int name="big">91</int>
           <int name="half">21</int>
           <int name="how">45</int>
           <int name="i">45</int>
           <int name="men">21</int>
           <int name="met">45</int>
           <int name="mother">45</int>
           <int name="theori">91</int>
           <int name="two">21</int>
           <int name="your">45</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>

And what I want is something like:

<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="series">
           <int name="Two and a Half Men">21</int>
           <int name="How I Met Your Mother">45</int>
           <int name="The Big Bang Theory">91</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>

Is there any possible way to do it with facet search? I don't want the
terms, I just want each string including the white spaces. Do I have to
change my fieldtype to do this?

Thanks to everybody.

Thiago 

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p3897853.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to facet data from a multivalued field?

Posted by Darren Govoni <da...@ontrenet.com>.
Your handler for that field should be looked at.
Try not using a handler that tokenizes or stems the field.
You want to leave the text as is. I forget the handler setting for that,
but its documented in there somewhere.


On Mon, 2012-04-09 at 13:02 -0700, Thiago wrote:
> Hello everybody,
> 
> I've already searched about this topic in the forum, but I didn't find any
> case like this. I ask for apologizes if this topic have been already
> discussed.
> 
> I'm having a problem in faceting a multivalued field. My field is called
> series, and it has names of TV series like the big bang theory, two and a
> half men ...
> 
> In this field I can have a lot of TV series names. For example:
> 
> <arr name="series">
>        <str>Two and a Half Men</str>
>        <str>How I Met Your Mother</str>
>        <str>The Big Bang Theory</str>
> </arr>
> 
> What I want to do is: search and count how many documents related to each
> series. I'm doing it using facet search in this field. But it's returning
> each word separately. Like this:
> 
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields">
> <lst name="series">
>            <int name="bang">91</int>
>            <int name="big">91</int>
>            <int name="half">21</int>
>            <int name="how">45</int>
>            <int name="i">45</int>
>            <int name="men">21</int>
>            <int name="met">45</int>
>            <int name="mother">45</int>
>            <int name="theori">91</int>
>            <int name="two">21</int>
>            <int name="your">45</int>
> </lst>
> </lst>
> <lst name="facet_dates"/>
> <lst name="facet_ranges"/>
> </lst>
> 
> And what I want is something like:
> 
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields">
> <lst name="series">
>            <int name="Two and a Half Men">21</int>
>            <int name="How I Met Your Mother">45</int>
>            <int name="The Big Bang Theory">91</int>
> </lst>
> </lst>
> <lst name="facet_dates"/>
> <lst name="facet_ranges"/>
> </lst>
> 
> Is there any possible way to do it with facet search? I don't want the
> terms, I just want each string including the white spaces. Do I have to
> change my fieldtype to do this?
> 
> Thanks to everybody.
> 
> Thiago 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p3897853.html
> Sent from the Solr - User mailing list archive at Nabble.com.
> 



Re: How to facet data from a multivalued field?

Posted by Raheel Hasan <ra...@gmail.com>.
oh got it.. Thanks a lot...


On Tue, Sep 10, 2013 at 10:10 PM, Erick Erickson <er...@gmail.com>wrote:

> You can't facet on fields where indexed="false". When you look at
> output docs, you're seeing _stored_ not indexed data. Set
> indexed="true" and re-index...
>
> Best,
> Erick
>
>
> On Tue, Sep 10, 2013 at 5:51 AM, Rah1x <ra...@yahoo.com> wrote:
>
> > Hi buddy,
> >
> > I am having this problem that I cant even reach to what you did at first
> > step..
> >
> > all I get is:
> > <lst name="series" />
> >
> > This is the schema:
> > <field name="series" type="string" indexed="false" stored="true"
> > required="false" omitTermFreqAndPositions="true" multiValued="true" />
> >
> > Note: the data is correctly placed in the field as the query results
> shows.
> > However, the facet is not working.
> >
> > Could you please share the schema of what you did to achieve it?
> >
> > Thanks a lot.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p4089045.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>



-- 
Regards,
Raheel Hasan

Re: How to facet data from a multivalued field?

Posted by Erick Erickson <er...@gmail.com>.
You can't facet on fields where indexed="false". When you look at
output docs, you're seeing _stored_ not indexed data. Set
indexed="true" and re-index...

Best,
Erick


On Tue, Sep 10, 2013 at 5:51 AM, Rah1x <ra...@yahoo.com> wrote:

> Hi buddy,
>
> I am having this problem that I cant even reach to what you did at first
> step..
>
> all I get is:
> <lst name="series" />
>
> This is the schema:
> <field name="series" type="string" indexed="false" stored="true"
> required="false" omitTermFreqAndPositions="true" multiValued="true" />
>
> Note: the data is correctly placed in the field as the query results shows.
> However, the facet is not working.
>
> Could you please share the schema of what you did to achieve it?
>
> Thanks a lot.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p4089045.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: How to facet data from a multivalued field?

Posted by Rah1x <ra...@yahoo.com>.
Hi buddy,

I am having this problem that I cant even reach to what you did at first
step..

all I get is:
<lst name="series" />         

This is the schema:
<field name="series" type="string" indexed="false" stored="true"
required="false" omitTermFreqAndPositions="true" multiValued="true" />

Note: the data is correctly placed in the field as the query results shows.
However, the facet is not working.

Could you please share the schema of what you did to achieve it?

Thanks a lot.



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p4089045.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to facet data from a multivalued field?

Posted by Thiago <th...@gmail.com>.
Thank you very much, Erik. I just changed the fieldtype to String and it
worked as I expected. Now I can select the count of the series. Thanks again
and thanks the others too.

Thiago


Erik Hatcher-4 wrote
> 
> Thiago -
> 
> You'll want your series field to be of type "string".   If you also need
> that field searchable by the words within them, you can copyField to a
> separate "text" (or other analyzed) field type where you search on the
> tokenized field but facet on the "string" one.
> 
> 	Erik
> 


--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p3902621.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to facet data from a multivalued field?

Posted by Erik Hatcher <er...@gmail.com>.
Thiago -

You'll want your series field to be of type "string".   If you also need that field searchable by the words within them, you can copyField to a separate "text" (or other analyzed) field type where you search on the tokenized field but facet on the "string" one.

	Erik

On Apr 9, 2012, at 16:02 , Thiago wrote:

> Hello everybody,
> 
> I've already searched about this topic in the forum, but I didn't find any
> case like this. I ask for apologizes if this topic have been already
> discussed.
> 
> I'm having a problem in faceting a multivalued field. My field is called
> series, and it has names of TV series like the big bang theory, two and a
> half men ...
> 
> In this field I can have a lot of TV series names. For example:
> 
> <arr name="series">
>       <str>Two and a Half Men</str>
>       <str>How I Met Your Mother</str>
>       <str>The Big Bang Theory</str>
> </arr>
> 
> What I want to do is: search and count how many documents related to each
> series. I'm doing it using facet search in this field. But it's returning
> each word separately. Like this:
> 
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields">
> <lst name="series">
>           <int name="bang">91</int>
>           <int name="big">91</int>
>           <int name="half">21</int>
>           <int name="how">45</int>
>           <int name="i">45</int>
>           <int name="men">21</int>
>           <int name="met">45</int>
>           <int name="mother">45</int>
>           <int name="theori">91</int>
>           <int name="two">21</int>
>           <int name="your">45</int>
> </lst>
> </lst>
> <lst name="facet_dates"/>
> <lst name="facet_ranges"/>
> </lst>
> 
> And what I want is something like:
> 
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields">
> <lst name="series">
>           <int name="Two and a Half Men">21</int>
>           <int name="How I Met Your Mother">45</int>
>           <int name="The Big Bang Theory">91</int>
> </lst>
> </lst>
> <lst name="facet_dates"/>
> <lst name="facet_ranges"/>
> </lst>
> 
> Is there any possible way to do it with facet search? I don't want the
> terms, I just want each string including the white spaces. Do I have to
> change my fieldtype to do this?
> 
> Thanks to everybody.
> 
> Thiago 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-facet-data-from-a-multivalued-field-tp3897853p3897853.html
> Sent from the Solr - User mailing list archive at Nabble.com.