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 Marek Tichy <ma...@gn.apc.org> on 2018/10/24 08:59:30 UTC

Solr filter query on STRING field [Was:Re: solr filter query on text field]

Hi,

I'm having troubles with the filter query on a multiple string field,
specifically with a space between words. Looking at the histogram and
values using Solr UI it correctly shows that the indexing stores the
string "Key case" as it should. However the following filter queries:

fq=sm_field_tags:Key case      //doesn't work
fq=sm_field_tags:Key+case      //doesn't work
fq=sm_field_tags:Key*             //does work
fq=sm_field_tags:Key?case     //does work


Debug shows (for the first case):
"filter_queries":["sm_field_tags:Key case"],
"parsed_filter_queries":["sm_field_tags:Key id:case"]

Why does it parse to id: case ? Solr version is 7.4.0

Many thanks
Marek









> bq.  is there any difference if the fq field is a string field vs test
>
> Absolutely. string fields are not analyzed in any way. They're not
> tokenized. There are case sensitive. Etc. For example takd
> My dog
> as input. A string field will have a _single_ token "My dog.". It will
> not match a search on "my". It will not match a search on "dog". It
> won't even match "my dog." as a phrase since the case is different. It
> won't even match "My dog" because there's no period at the end. It
> will only match "My dog.".


Re: Solr filter query on STRING field [Was:Re: solr filter query on text field]

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
First one treats space as end of operation, so the second keyword is
searched against default field (id). Try putting the whole thing into the
quotes. Or use Field Query Parser:
https://lucene.apache.org/solr/guide/7_5/other-parsers.html#field-query-parser

Regards,
   Alex.

On Wed, Oct 24, 2018, 4:59 AM Marek Tichy, <ma...@gn.apc.org> wrote:

> Hi,
>
> I'm having troubles with the filter query on a multiple string field,
> specifically with a space between words. Looking at the histogram and
> values using Solr UI it correctly shows that the indexing stores the
> string "Key case" as it should. However the following filter queries:
>
> fq=sm_field_tags:Key case      //doesn't work
> fq=sm_field_tags:Key+case      //doesn't work
> fq=sm_field_tags:Key*             //does work
> fq=sm_field_tags:Key?case     //does work
>
>
> Debug shows (for the first case):
> "filter_queries":["sm_field_tags:Key case"],
> "parsed_filter_queries":["sm_field_tags:Key id:case"]
>
> Why does it parse to id: case ? Solr version is 7.4.0
>
> Many thanks
> Marek
>
>
>
>
>
>
>
>
>
> > bq.  is there any difference if the fq field is a string field vs test
> >
> > Absolutely. string fields are not analyzed in any way. They're not
> > tokenized. There are case sensitive. Etc. For example takd
> > My dog
> > as input. A string field will have a _single_ token "My dog.". It will
> > not match a search on "my". It will not match a search on "dog". It
> > won't even match "my dog." as a phrase since the case is different. It
> > won't even match "My dog" because there's no period at the end. It
> > will only match "My dog.".
>
>