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 elivis <el...@basistech.com> on 2021/01/30 14:41:03 UTC

How to get case-sensitive Terms?

I'm using Terms Component functionality
(https://lucene.apache.org/solr/guide/8_4/the-terms-component.html) to get
all terms from an index. However, I need the terms to be in the original
case lettering (e.g. "TeSt"). So far I am only able to get lowercased terms
(i.e. "test" instead of "TeSt"). 

Can somebody please let me know if this is possible, and if so, how to do
this?

Thank you!




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by elivis <el...@basistech.com>.
Alexandre Rafalovitch wrote
> Admin UI also allows you to run text string against a field definition to
> see what each stage of analyzer chain does.

Thank you. Could you please give me some pointers how to achieve this (see
what each stage of analyzer chain does in Admin UI)?




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Terms query does not do analysis chain, but expect tokenized values.
Because it matches what is returned by faceting.

So I would check whether that field is string or text and difference in
processing. Enabling debug will also show difference in final expanded
form.

Regards,
    Alex
P. S. It is better to start new question threads for new questions. More
people will pay attention.

On Thu., Feb. 18, 2021, 1:31 a.m. elivis, <el...@basistech.com> wrote:

> Alexandre Rafalovitch wrote
> > What about copyField with the target being index only (docValue only?)
> and
> > no lowercase on the target field type?
> >
> > Solr is not a database, you are optimising for search. So duplicate,
> > multi-process, denormalise, create custom field types, etc.
> >
> > Regards,
> >    Alex
>
> Thank you!
>
> One more question - when we index data, we have some other fields that we
> are populating. Our data comes from different inputs, so one of those
> fields
> is a data source ID that the text came from. Wen we do search, we are able
> to get search results specific to only that data source by adding filter
> query (e.g. fq=image_id:1). However, that doesn't seem to work when doing a
> terms query - I always get the terms from the entire index. Is there a way
> to filter the terms?
>
> Thank you again.
>
>
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>

Re: How to get case-sensitive Terms?

Posted by elivis <el...@basistech.com>.
Alexandre Rafalovitch wrote
> What about copyField with the target being index only (docValue only?) and
> no lowercase on the target field type?
> 
> Solr is not a database, you are optimising for search. So duplicate,
> multi-process, denormalise, create custom field types, etc.
> 
> Regards,
>    Alex

Thank you! 

One more question - when we index data, we have some other fields that we
are populating. Our data comes from different inputs, so one of those fields
is a data source ID that the text came from. Wen we do search, we are able
to get search results specific to only that data source by adding filter
query (e.g. fq=image_id:1). However, that doesn't seem to work when doing a
terms query - I always get the terms from the entire index. Is there a way
to filter the terms?

Thank you again.





--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
What about copyField with the target being index only (docValue only?) and
no lowercase on the target field type?

Solr is not a database, you are optimising for search. So duplicate,
multi-process, denormalise, create custom field types, etc.

Regards,
   Alex

On Wed., Feb. 3, 2021, 4:43 p.m. elivis, <el...@basistech.com> wrote:

> Alexandre Rafalovitch wrote
> > It is documented in the reference guide:
> > https://lucene.apache.org/solr/guide/8_8/analysis-screen.html
> >
> > Hope it helps,
> >    Alex.
> >
> > On Tue, 2 Feb 2021 at 00:57, elivis &lt;
>
> > elivis@
>
> > &gt; wrote:
> >>
> >> Alexandre Rafalovitch wrote
> >> > Admin UI also allows you to run text string against a field definition
> >> to
> >> > see what each stage of analyzer chain does.
> >>
> >> Thank you. Could please let me know how to do this (see what each stage
> >> of
> >> analyzer chain does)?
> >>
> >>
> >>
> >>
> >> --
> >> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>
> Thank you, Alex! We were indeed using the LowerCaseFilterFactory on the
> text
> field that I'm using, and if I remove it from the schema, I do indeed get
> case sensitive terms. However, I don't think I can just remove the
> LowerCaseFilterFactory and call it a day. The reason we are using it is
> because we want our "exact match" searches to NOT be case sensitive - a
> search for "John" should return hits for "John" or "john". Is there a way
> to
> achieve this result in an efficient manner, if I remove the
> LowerCaseFilterFactory?
>
> Thank you again.
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>

Re: How to get case-sensitive Terms?

Posted by elivis <el...@basistech.com>.
Alexandre Rafalovitch wrote
> It is documented in the reference guide:
> https://lucene.apache.org/solr/guide/8_8/analysis-screen.html
> 
> Hope it helps,
>    Alex.
> 
> On Tue, 2 Feb 2021 at 00:57, elivis &lt;

> elivis@

> &gt; wrote:
>>
>> Alexandre Rafalovitch wrote
>> > Admin UI also allows you to run text string against a field definition
>> to
>> > see what each stage of analyzer chain does.
>>
>> Thank you. Could please let me know how to do this (see what each stage
>> of
>> analyzer chain does)?
>>
>>
>>
>>
>> --
>> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Thank you, Alex! We were indeed using the LowerCaseFilterFactory on the text
field that I'm using, and if I remove it from the schema, I do indeed get
case sensitive terms. However, I don't think I can just remove the
LowerCaseFilterFactory and call it a day. The reason we are using it is
because we want our "exact match" searches to NOT be case sensitive - a
search for "John" should return hits for "John" or "john". Is there a way to
achieve this result in an efficient manner, if I remove the
LowerCaseFilterFactory? 

Thank you again.



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
It is documented in the reference guide:
https://lucene.apache.org/solr/guide/8_8/analysis-screen.html

Hope it helps,
   Alex.

On Tue, 2 Feb 2021 at 00:57, elivis <el...@basistech.com> wrote:
>
> Alexandre Rafalovitch wrote
> > Admin UI also allows you to run text string against a field definition to
> > see what each stage of analyzer chain does.
>
> Thank you. Could please let me know how to do this (see what each stage of
> analyzer chain does)?
>
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by elivis <el...@basistech.com>.
Alexandre Rafalovitch wrote
> Admin UI also allows you to run text string against a field definition to
> see what each stage of analyzer chain does.

Thank you. Could please let me know how to do this (see what each stage of
analyzer chain does)?




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to get case-sensitive Terms?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Check the field type and associated indexing chain in managed-schema of
your core. It probably has the lowercase filter in it.

Find a better type or make one yourself. Remember to reload the schema and
reindex the content.

Admin UI also allows you to run text string against a field definition to
see what each stage of analyzer chain does.

Regards,
    Alex

On Sat., Jan. 30, 2021, 12:59 p.m. elivis, <el...@basistech.com> wrote:

> I'm using Terms Component functionality
> (https://lucene.apache.org/solr/guide/8_4/the-terms-component.html) to get
> all terms from an index. However, I need the terms to be in the original
> case lettering (e.g. "TeSt"). So far I am only able to get lowercased terms
> (i.e. "test" instead of "TeSt").
>
> Can somebody please let me know if this is possible, and if so, how to do
> this?
>
> Thank you!
>
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>