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 Giri <gi...@gmail.com> on 2007/08/30 17:56:19 UTC
Facet for multiple values field
Hi,
I am trying to get the facet values from a field that contains multiple
words, for example:
I have a field "keywords"
and values for this: Keywords= relative humidity, air temperature,
atmospheric moisture
Please note: I am combining multiple keywords in to one single field, with
comma delimiter
When I query for facet, I am getting some thing like:
- relative (10)
- humidity (10)
- temperature (5)
But I really need to display:
- relative humidity(10)
- air temperature(5)
How can I do this? I know I am missing something in my schema field type
declaration. I would appreciate if any one can post me an example schema
field type that can handle this.
Thanks!
Here is my schema excerpt:
<fieldtype name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory"
synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldtype>
And, the I declared the field as:
<field name="sensor" type="text" indexed="true" stored="true"/>
Re: Facet for multiple values field
Posted by Mike Klaas <mi...@gmail.com>.
On 30-Aug-07, at 1:41 PM, Giri wrote:
> Tom,
>
> Thank you very much for the help.
>
>>> If I have multiple values, I add them as separate occurrences of
>>> the field
> I
> am faceting on.
>
> Is this means, for a single record, I can add multiple values for a
> field?
> for example for the file "sensor" I can send multiple values?
Yes. The one-term-per-field restriction applies to:
a) sorting
b) _optimization_ of facets.
-Mike
Re: Facet for multiple values field
Posted by Giri <gi...@gmail.com>.
Tom,
Thank you very much for the help.
>>If I have multiple values, I add them as separate occurrences of the field
I
am faceting on.
Is this means, for a single record, I can add multiple values for a field?
for example for the file "sensor" I can send multiple values?
Let me try this and get back to you.
Thanks again for the help.
Giri
On 8/30/07, Tom Hill <so...@zvents.com> wrote:
>
> Hi -
>
> I wouldn't facet on a "text" field, I tend to use "string" for the reasons
> you describe. e.g. Use
>
> <field name="neighborhood_id" type="string" indexed="true"
> stored="true"
> multiValued="true"/>
> or in your example
> <field name="sensor" type="string" indexed="true" stored="true"
> multiValued="true"/>
>
> If I have multiple values, I add them as separate occurrences of the field
> I
> am faceting on.
>
> If you still need them all in one field for other reasons, use copyField
> to
> assemble them.
>
> Tom
>
> On 8/30/07, Giri <gi...@gmail.com> wrote:
> >
> > Hi,
> >
> > I am trying to get the facet values from a field that contains multiple
> > words, for example:
> >
> > I have a field "keywords"
> >
> > and values for this: Keywords= relative humidity, air temperature,
> > atmospheric moisture
> >
> > Please note: I am combining multiple keywords in to one single field,
> with
> > comma delimiter
> >
> > When I query for facet, I am getting some thing like:
> >
> > - relative (10)
> >
> > - humidity (10)
> >
> > - temperature (5)
> >
> >
> > But I really need to display:
> >
> > - relative humidity(10)
> >
> > - air temperature(5)
> >
> >
> > How can I do this? I know I am missing something in my schema field type
> > declaration. I would appreciate if any one can post me an example schema
> > field type that can handle this.
> >
> > Thanks!
> >
> >
> > Here is my schema excerpt:
> >
> > <fieldtype name="text" class="solr.TextField"
> > positionIncrementGap="100">
> >
> > <analyzer type="index">
> >
> > <tokenizer class="solr.WhitespaceTokenizerFactory"/>
> >
> > <!-- in this example, we will only use synonyms at query time
> >
> > <filter class="solr.SynonymFilterFactory"
> > synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
> >
> > -->
> >
> > <filter class="solr.WordDelimiterFilterFactory"
> > generateWordParts="1"/>
> >
> > <filter class="solr.StopFilterFactory" ignoreCase="true"/>
> >
> > <filter class="solr.LowerCaseFilterFactory"/>
> >
> > </analyzer>
> >
> > <analyzer type="query">
> >
> > <tokenizer class="solr.WhitespaceTokenizerFactory"/>
> >
> > <filter class="solr.StopFilterFactory" ignoreCase="true"/>
> >
> > <filter class="solr.LowerCaseFilterFactory"/>
> >
> > </analyzer>
> >
> > </fieldtype>
> >
> >
> >
> > And, the I declared the field as:
> >
> > <field name="sensor" type="text" indexed="true" stored="true"/>
>
--
Giri the C
Knoxville
TN
Re: Facet for multiple values field
Posted by Tom Hill <so...@zvents.com>.
Hi -
I wouldn't facet on a "text" field, I tend to use "string" for the reasons
you describe. e.g. Use
<field name="neighborhood_id" type="string" indexed="true" stored="true"
multiValued="true"/>
or in your example
<field name="sensor" type="string" indexed="true" stored="true"
multiValued="true"/>
If I have multiple values, I add them as separate occurrences of the field I
am faceting on.
If you still need them all in one field for other reasons, use copyField to
assemble them.
Tom
On 8/30/07, Giri <gi...@gmail.com> wrote:
>
> Hi,
>
> I am trying to get the facet values from a field that contains multiple
> words, for example:
>
> I have a field "keywords"
>
> and values for this: Keywords= relative humidity, air temperature,
> atmospheric moisture
>
> Please note: I am combining multiple keywords in to one single field, with
> comma delimiter
>
> When I query for facet, I am getting some thing like:
>
> - relative (10)
>
> - humidity (10)
>
> - temperature (5)
>
>
> But I really need to display:
>
> - relative humidity(10)
>
> - air temperature(5)
>
>
> How can I do this? I know I am missing something in my schema field type
> declaration. I would appreciate if any one can post me an example schema
> field type that can handle this.
>
> Thanks!
>
>
> Here is my schema excerpt:
>
> <fieldtype name="text" class="solr.TextField"
> positionIncrementGap="100">
>
> <analyzer type="index">
>
> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>
> <!-- in this example, we will only use synonyms at query time
>
> <filter class="solr.SynonymFilterFactory"
> synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
>
> -->
>
> <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1"/>
>
> <filter class="solr.StopFilterFactory" ignoreCase="true"/>
>
> <filter class="solr.LowerCaseFilterFactory"/>
>
> </analyzer>
>
> <analyzer type="query">
>
> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>
> <filter class="solr.StopFilterFactory" ignoreCase="true"/>
>
> <filter class="solr.LowerCaseFilterFactory"/>
>
> </analyzer>
>
> </fieldtype>
>
>
>
> And, the I declared the field as:
>
> <field name="sensor" type="text" indexed="true" stored="true"/>