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 Grzegorz Sobczyk <gr...@contium.pl> on 2012/10/29 13:03:14 UTC

facet prefix with tokenized fields

Hi.
Is there any solution to facet documents with specified prefix on some  
tokenized field, but in result gets the original value of a field?

e.q.:
<field name="category_ac" type="text_autocomplete" indexed="true"  
stored="true" multiValued="true" />

<fieldType name="text_autocomplete" class="solr.TextField">
   <analyzer>
   <tokenizer class="solr.StandardTokenizerFactory" />
   <filter class="solr.LowerCaseFilterFactory" />
   </analyzer>
</fieldType>


Indexed value: "toys for children"
query:  
q=&start=0&rows=0&facet.limit=-1&facet.mincount=1&f.category_ac.facet.prefix=chi&facet.field=category_ac&facet=true

I'd like to get exacly "toys for children", not "children"

--
Grzegorz Sobczyk

Re: facet prefix with tokenized fields

Posted by Grzegorz Sobczyk <gr...@contium.pl>.
I'd like to use faceting. I don't want list of documents.

Using ngram would give me response which is useless for me.

Querying smth like this:
fq=category_ngram:child&facet.field=category_exactly

would give me something like this (for multivalued category fields):
"toys for children"
"games"
"memory"
"tv"




W dniu 29.10.2012 o 13:12 Rafał Kuć <r....@solr.pl> pisze:

> Hello!
>
> Do you have to use faceting for prefixing ? Maybe it would be better to  
> use ngram based field and return the stored value ?
>
>


-- 
Grzegorz Sobczyk


Re: facet prefix with tokenized fields

Posted by Rafał Kuć <r....@solr.pl>.
Hello!

Do you have to use faceting for prefixing ? Maybe it would be better to use ngram based field and return the stored value ?


-- 
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

>  
> Hi.

> Is there any solution to facet documents with specified prefix on
> some tokenized field, but in result gets the original value of a field?




> e.q.: 

> <field name="category_ac" type="text_autocomplete" indexed="true"
> stored="true" multiValued="true" />


>                 <fieldType name="text_autocomplete" class="solr.TextField">
>                 <analyzer>
>                         <tokenizer
> class="solr.StandardTokenizerFactory" />
>                         <filter class="solr.LowerCaseFilterFactory" />
>                 </analyzer>
>                 </fieldType>







> Indexed value: "toys for children"

> query:
> q=&start=0&rows=0&facet.limit=-1&facet.mincount=1&f.category_ac.facet.prefix=chi&facet.field=category_ac&facet=true




> I'd like to get exacly "toys for children", not "children"




> --

> Grzegorz Sobczyk




Re: facet prefix with tokenized fields

Posted by Erick Erickson <er...@gmail.com>.
In short, no. The problem is that faceting is working by counting
documents with distinct tokens in the field. So in your example
I'd expect you to see facets for "toys", "for", "children". All it
has to work with are the tokens, the fact that the original input
was three words is completely lost at this point.

You could index these with keywordTokenizer and facet on
_that_ field, which would work in this case. I don't know how
well that would fit into the rest of your app though.

Best
Erick

On Mon, Oct 29, 2012 at 8:03 AM, Grzegorz Sobczyk
<gr...@contium.pl> wrote:
> Hi.
> Is there any solution to facet documents with specified prefix on some
> tokenized field, but in result gets the original value of a field?
>
> e.q.:
> <field name="category_ac" type="text_autocomplete" indexed="true"
> stored="true" multiValued="true" />
>
> <fieldType name="text_autocomplete" class="solr.TextField">
>   <analyzer>
>   <tokenizer class="solr.StandardTokenizerFactory" />
>   <filter class="solr.LowerCaseFilterFactory" />
>   </analyzer>
> </fieldType>
>
>
> Indexed value: "toys for children"
> query:
> q=&start=0&rows=0&facet.limit=-1&facet.mincount=1&f.category_ac.facet.prefix=chi&facet.field=category_ac&facet=true
>
> I'd like to get exacly "toys for children", not "children"
>
> --
> Grzegorz Sobczyk