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 Gopesh Sharma <Go...@gensler.com> on 2018/01/25 10:41:17 UTC

Grouping on Exact Match

Hello All,

I am grouping the results but the groups are not happening on the exact match. For Example : I have 5 documents with name Construction Company, Construction Tower, Tower Company, Tower House and again Construction Company. If I search for Construction Company with grouping I am getting result as


  *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.

Is there any way I can get only two results with group value as exact match of the search item.

Thanks,
Gopesh Sharma

Re: Grouping on Exact Match

Posted by Emir Arnautović <em...@sematext.com>.
Is it possible that this field used to be text_en field and later you changed it to string_lower but did not reindex. If you open schema explorer in your admin GUI, what tokens do you see for this field?

Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 25 Jan 2018, at 12:25, Gopesh Sharma <Go...@gensler.com> wrote:
> 
> Hello Emir,
> 
> Service.Solr/partners/select/?wt=json&fq=-partnerProjectCount_num:0&bf=searchScore_num&sort=score+desc&q=Construction%20Company&group=true&group.field=partnerName_text_en&group.ngroups=true&group.limit=100&rows=50&start=0&indent=true 
> 
> <field name=" partnerName_text_en"  type="string_lower" indexed="true"  stored="true" multiValued="false" />
> 
> I am using the above query.
> 
> Thanks,
> Gopesh Sharma
> 
> -----Original Message-----
> From: Emir Arnautović [mailto:emir.arnautovic@sematext.com] 
> Sent: Thursday, January 25, 2018 4:31 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Grouping on Exact Match
> 
> Hi Gopesh,
> No it is not - at least not in a way I was thinking. I should have been more precise - I meant tokenized. So you are grouping on the field that uses this  field type? Can you share query?
> 
> Thanks,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting Support Training - https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsematext.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7C04a138e3daf7423ba05f08d563e2e1ef%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C636524748464316159&sdata=wuZfMQmGJbnHkPVMjtnUysxHud4U9wP57tDh9kPKNig%3D&reserved=0
> 
> 
> 
>> On 25 Jan 2018, at 11:57, Gopesh Sharma <Go...@gensler.com> wrote:
>> 
>> Hello Emir,
>> 
>> Thanks for the reply.
>> 
>> So if I am using below field type for the field, that means its analyzed?
>> 
>> <fieldType name="string_lower" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
>>       <analyzer type="index">
>>           <tokenizer class="solr.KeywordTokenizerFactory"/>
>>           <filter class="solr.LowerCaseFilterFactory"/>
>>       </analyzer>
>>       <analyzer type="query">
>>           <tokenizer class="solr.KeywordTokenizerFactory"/>
>>           <filter class="solr.LowerCaseFilterFactory"/>
>>       </analyzer>
>> </fieldType>
>> 
>> Thanks,
>> Gopesh Sharma
>> 
>> -----Original Message-----
>> From: Emir Arnautović [mailto:emir.arnautovic@sematext.com]
>> Sent: Thursday, January 25, 2018 4:16 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Grouping on Exact Match
>> 
>> Hi Gopesh,
>> You are probably grouping on field that is analysed so “Consulting” is group term. What you need to do is to have name field that is not alalysed and group on that field. If you want to “group” on query input, that is not grouping - you simply use phrase query and all results are of that group.
>> 
>> HTH,
>> Emir
>> --
>> Monitoring - Log Management - Alerting - Anomaly Detection Solr & 
>> Elasticsearch Consulting Support Training - 
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsemate
>> xt.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7Cda7c34701f32465
>> 883cc08d563e0ddd3%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C6365247
>> 39799609813&sdata=yXhlw36459RoXTKifDyGPVy1bgTpcVWOdHfViuGJgg8%3D&reser
>> ved=0
>> 
>> 
>> 
>>> On 25 Jan 2018, at 11:41, Gopesh Sharma <Go...@gensler.com> wrote:
>>> 
>>> Hello All,
>>> 
>>> I am grouping the results but the groups are not happening on the 
>>> exact match. For Example : I have 5 documents with name Construction 
>>> Company, Construction Tower, Tower Company, Tower House and again 
>>> Construction Company. If I search for Construction Company with 
>>> grouping I am getting result as
>>> 
>>> 
>>> *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.
>>> 
>>> Is there any way I can get only two results with group value as exact match of the search item.
>>> 
>>> Thanks,
>>> Gopesh Sharma
>> 
> 


RE: Grouping on Exact Match

Posted by Gopesh Sharma <Go...@gensler.com>.
Hello Emir,

Service.Solr/partners/select/?wt=json&fq=-partnerProjectCount_num:0&bf=searchScore_num&sort=score+desc&q=Construction%20Company&group=true&group.field=partnerName_text_en&group.ngroups=true&group.limit=100&rows=50&start=0&indent=true 

<field name=" partnerName_text_en"  type="string_lower" indexed="true"  stored="true" multiValued="false" />

I am using the above query.

Thanks,
Gopesh Sharma

-----Original Message-----
From: Emir Arnautović [mailto:emir.arnautovic@sematext.com] 
Sent: Thursday, January 25, 2018 4:31 PM
To: solr-user@lucene.apache.org
Subject: Re: Grouping on Exact Match

Hi Gopesh,
No it is not - at least not in a way I was thinking. I should have been more precise - I meant tokenized. So you are grouping on the field that uses this  field type? Can you share query?

Thanks,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting Support Training - https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsematext.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7C04a138e3daf7423ba05f08d563e2e1ef%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C636524748464316159&sdata=wuZfMQmGJbnHkPVMjtnUysxHud4U9wP57tDh9kPKNig%3D&reserved=0



> On 25 Jan 2018, at 11:57, Gopesh Sharma <Go...@gensler.com> wrote:
> 
> Hello Emir,
> 
> Thanks for the reply.
> 
> So if I am using below field type for the field, that means its analyzed?
> 
> <fieldType name="string_lower" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
>        <analyzer type="index">
>            <tokenizer class="solr.KeywordTokenizerFactory"/>
>            <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
>        <analyzer type="query">
>            <tokenizer class="solr.KeywordTokenizerFactory"/>
>            <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
> </fieldType>
> 
> Thanks,
> Gopesh Sharma
> 
> -----Original Message-----
> From: Emir Arnautović [mailto:emir.arnautovic@sematext.com]
> Sent: Thursday, January 25, 2018 4:16 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Grouping on Exact Match
> 
> Hi Gopesh,
> You are probably grouping on field that is analysed so “Consulting” is group term. What you need to do is to have name field that is not alalysed and group on that field. If you want to “group” on query input, that is not grouping - you simply use phrase query and all results are of that group.
> 
> HTH,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection Solr & 
> Elasticsearch Consulting Support Training - 
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsemate
> xt.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7Cda7c34701f32465
> 883cc08d563e0ddd3%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C6365247
> 39799609813&sdata=yXhlw36459RoXTKifDyGPVy1bgTpcVWOdHfViuGJgg8%3D&reser
> ved=0
> 
> 
> 
>> On 25 Jan 2018, at 11:41, Gopesh Sharma <Go...@gensler.com> wrote:
>> 
>> Hello All,
>> 
>> I am grouping the results but the groups are not happening on the 
>> exact match. For Example : I have 5 documents with name Construction 
>> Company, Construction Tower, Tower Company, Tower House and again 
>> Construction Company. If I search for Construction Company with 
>> grouping I am getting result as
>> 
>> 
>> *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.
>> 
>> Is there any way I can get only two results with group value as exact match of the search item.
>> 
>> Thanks,
>> Gopesh Sharma
> 


Re: Grouping on Exact Match

Posted by Emir Arnautović <em...@sematext.com>.
Hi Gopesh,
No it is not - at least not in a way I was thinking. I should have been more precise - I meant tokenized. So you are grouping on the field that uses this  field type? Can you share query?

Thanks,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 25 Jan 2018, at 11:57, Gopesh Sharma <Go...@gensler.com> wrote:
> 
> Hello Emir,
> 
> Thanks for the reply.
> 
> So if I am using below field type for the field, that means its analyzed?
> 
> <fieldType name="string_lower" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
>        <analyzer type="index">
>            <tokenizer class="solr.KeywordTokenizerFactory"/>
>            <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
>        <analyzer type="query">
>            <tokenizer class="solr.KeywordTokenizerFactory"/>
>            <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
> </fieldType>
> 
> Thanks,
> Gopesh Sharma
> 
> -----Original Message-----
> From: Emir Arnautović [mailto:emir.arnautovic@sematext.com] 
> Sent: Thursday, January 25, 2018 4:16 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Grouping on Exact Match
> 
> Hi Gopesh,
> You are probably grouping on field that is analysed so “Consulting” is group term. What you need to do is to have name field that is not alalysed and group on that field. If you want to “group” on query input, that is not grouping - you simply use phrase query and all results are of that group.
> 
> HTH,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting Support Training - https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsematext.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7Cda7c34701f32465883cc08d563e0ddd3%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C636524739799609813&sdata=yXhlw36459RoXTKifDyGPVy1bgTpcVWOdHfViuGJgg8%3D&reserved=0
> 
> 
> 
>> On 25 Jan 2018, at 11:41, Gopesh Sharma <Go...@gensler.com> wrote:
>> 
>> Hello All,
>> 
>> I am grouping the results but the groups are not happening on the 
>> exact match. For Example : I have 5 documents with name Construction 
>> Company, Construction Tower, Tower Company, Tower House and again 
>> Construction Company. If I search for Construction Company with 
>> grouping I am getting result as
>> 
>> 
>> *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.
>> 
>> Is there any way I can get only two results with group value as exact match of the search item.
>> 
>> Thanks,
>> Gopesh Sharma
> 


RE: Grouping on Exact Match

Posted by Gopesh Sharma <Go...@gensler.com>.
Hello Emir,

Thanks for the reply.

So if I am using below field type for the field, that means its analyzed?

<fieldType name="string_lower" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
        <analyzer type="index">
            <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
</fieldType>

Thanks,
Gopesh Sharma

-----Original Message-----
From: Emir Arnautović [mailto:emir.arnautovic@sematext.com] 
Sent: Thursday, January 25, 2018 4:16 PM
To: solr-user@lucene.apache.org
Subject: Re: Grouping on Exact Match

Hi Gopesh,
You are probably grouping on field that is analysed so “Consulting” is group term. What you need to do is to have name field that is not alalysed and group on that field. If you want to “group” on query input, that is not grouping - you simply use phrase query and all results are of that group.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting Support Training - https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsematext.com%2F&data=02%7C01%7CGopesh_Sharma%40gensler.com%7Cda7c34701f32465883cc08d563e0ddd3%7C94a74758f2ff413c9f705725701b8d02%7C0%7C0%7C636524739799609813&sdata=yXhlw36459RoXTKifDyGPVy1bgTpcVWOdHfViuGJgg8%3D&reserved=0



> On 25 Jan 2018, at 11:41, Gopesh Sharma <Go...@gensler.com> wrote:
> 
> Hello All,
> 
> I am grouping the results but the groups are not happening on the 
> exact match. For Example : I have 5 documents with name Construction 
> Company, Construction Tower, Tower Company, Tower House and again 
> Construction Company. If I search for Construction Company with 
> grouping I am getting result as
> 
> 
>  *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.
> 
> Is there any way I can get only two results with group value as exact match of the search item.
> 
> Thanks,
> Gopesh Sharma


Re: Grouping on Exact Match

Posted by Emir Arnautović <em...@sematext.com>.
Hi Gopesh,
You are probably grouping on field that is analysed so “Consulting” is group term. What you need to do is to have name field that is not alalysed and group on that field. If you want to “group” on query input, that is not grouping - you simply use phrase query and all results are of that group.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 25 Jan 2018, at 11:41, Gopesh Sharma <Go...@gensler.com> wrote:
> 
> Hello All,
> 
> I am grouping the results but the groups are not happening on the exact match. For Example : I have 5 documents with name Construction Company, Construction Tower, Tower Company, Tower House and again Construction Company. If I search for Construction Company with grouping I am getting result as
> 
> 
>  *   Construction having 3 documents -  Construction Company, Construction Tower and Construction Company with group value construction.
> 
> Is there any way I can get only two results with group value as exact match of the search item.
> 
> Thanks,
> Gopesh Sharma