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 PeterKerk <ve...@hotmail.com> on 2012/12/31 10:54:13 UTC

Filter on multiple word field of type "string" not showing any results

I'm trying to filter on the field functiontitle_nl when the user selects
"Management en Organisatie", but I'm getting 0 results.
The actual value in the DB is "Management en Organisatie". 

This is the URL I build up to query the Solr index:
http://localhost:8983/solr/zz_vacs/select/?indent=on&facet=true&fq=functiontitle_nl:management%20en%20organisatie&sort=createdate%20desc&q=*:*&start=0&rows=10&fl=id,listingid,title,friendlyurl,logo,description,functiontitle_nl,publishdate,enddate,province,provinceid,city,lat,lng&facet.field=country_raw_nl&facet.field=sectors_raw_nl&facet.field=functiontitle_nl&facet.field=province_raw&facet.field=city&facet.field=advertisertitle&facet.mincount=1

I know the value in the URL is lowercase, but this has never been a problem
with other projects I have had. Also when I change the URL to match the
casing in the DB it still doesn't work.

I also tried text_ws and text as type instead of string, but then the
functiontitle_nl facet in the browser will break up the value in separate
words: "Management" "en" "Organisatie".
I tried the tokenizer test tools in the Solr admin panel, but I'm not sure
what to enter and can't make sense of the results.
I have restarted and re-indexed Solr every time I changed something in the
schema.xml (and even data-config.xml)

Definition of functiontitle_nl in my schema.xml:
<fieldType name="string" class="solr.StrField" sortMissingLast="true"
omitNorms="true" />

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




--
View this message in context: http://lucene.472066.n3.nabble.com/Filter-on-multiple-word-field-of-type-string-not-showing-any-results-tp4029765.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Filter on multiple word field of type "string" not showing any results

Posted by Upayavira <uv...@odoko.co.uk>.
You should lowercase by creating a field of a new type, with an analysis
chain. The KeywordTokenizerFactory will spit out the whole string as a
single token. You can then use the LowerCaseFilterFactory to do the real
work. The end result is a single token, which is effectively the same
things as is achieved by a Field of type string.

Upayavira

On Mon, Dec 31, 2012, at 01:08 PM, Tomás Fernández Löbbe wrote:
> It can't be *really* case independent. You could lowercase everything,
> but
> you'd see the facet value in lowercase too. If you really need to search
> in
> lowercase and display the original content on the facet value you could
> use
> two fields, one for faceting (of type string) and one for filtering (of a
> type that uses KeywordTokenizer and LowercaseFilter). This has the
> disadvantage of growing the size of your index, make sure you really need
> to search in lowercase.
> 
> Tomás
> 
> 
> On Mon, Dec 31, 2012 at 9:56 AM, PeterKerk <ve...@hotmail.com>
> wrote:
> 
> > The quoting with casing works indeed :). How can I make it case
> > independent?
> >
> >
> >
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/Filter-on-multiple-word-field-of-type-string-not-showing-any-results-tp4029765p4029771.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >

Re: Filter on multiple word field of type "string" not showing any results

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
It can't be *really* case independent. You could lowercase everything, but
you'd see the facet value in lowercase too. If you really need to search in
lowercase and display the original content on the facet value you could use
two fields, one for faceting (of type string) and one for filtering (of a
type that uses KeywordTokenizer and LowercaseFilter). This has the
disadvantage of growing the size of your index, make sure you really need
to search in lowercase.

Tomás


On Mon, Dec 31, 2012 at 9:56 AM, PeterKerk <ve...@hotmail.com> wrote:

> The quoting with casing works indeed :). How can I make it case
> independent?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Filter-on-multiple-word-field-of-type-string-not-showing-any-results-tp4029765p4029771.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Filter on multiple word field of type "string" not showing any results

Posted by PeterKerk <ve...@hotmail.com>.
The quoting with casing works indeed :). How can I make it case independent?



--
View this message in context: http://lucene.472066.n3.nabble.com/Filter-on-multiple-word-field-of-type-string-not-showing-any-results-tp4029765p4029771.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Filter on multiple word field of type "string" not showing any results

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
Try with quotes or escaping whitespaces:
fq:"Management en Organisatie"
...or
fq:Management\ en\ Organisatie

Make sure you use the correct case.

Tomás


On Mon, Dec 31, 2012 at 6:54 AM, PeterKerk <ve...@hotmail.com> wrote:

> I'm trying to filter on the field functiontitle_nl when the user selects
> "Management en Organisatie", but I'm getting 0 results.
> The actual value in the DB is "Management en Organisatie".
>
> This is the URL I build up to query the Solr index:
>
> http://localhost:8983/solr/zz_vacs/select/?indent=on&facet=true&fq=functiontitle_nl:management%20en%20organisatie&sort=createdate%20desc&q=*:*&start=0&rows=10&fl=id,listingid,title,friendlyurl,logo,description,functiontitle_nl,publishdate,enddate,province,provinceid,city,lat,lng&facet.field=country_raw_nl&facet.field=sectors_raw_nl&facet.field=functiontitle_nl&facet.field=province_raw&facet.field=city&facet.field=advertisertitle&facet.mincount=1
>
> I know the value in the URL is lowercase, but this has never been a problem
> with other projects I have had. Also when I change the URL to match the
> casing in the DB it still doesn't work.
>
> I also tried text_ws and text as type instead of string, but then the
> functiontitle_nl facet in the browser will break up the value in separate
> words: "Management" "en" "Organisatie".
> I tried the tokenizer test tools in the Solr admin panel, but I'm not sure
> what to enter and can't make sense of the results.
> I have restarted and re-indexed Solr every time I changed something in the
> schema.xml (and even data-config.xml)
>
> Definition of functiontitle_nl in my schema.xml:
> <fieldType name="string" class="solr.StrField" sortMissingLast="true"
> omitNorms="true" />
>
> <field name="functiontitle_nl" type="string" indexed="true" stored="true"/>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Filter-on-multiple-word-field-of-type-string-not-showing-any-results-tp4029765.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>