lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hanjan, Harinder" <Harinder.Han...@calgary.ca>
Subject RE: [EXT] Re: Faceting with a multi valued field
Date Thu, 27 Sep 2018 18:44:58 GMT
I control everything except the data that's being indexed. So I can manipulate the Solr query
as needed.

I tried the facet.prefix option and initial testing shows promise. 
q=*:*&facet=on&facet.field=Communities&f.Communities.facet.prefix=BANFF+TRAIL+-+BNF

Thanks much! 


-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafalov@gmail.com] 
Sent: Tuesday, September 25, 2018 3:14 PM
To: solr-user
Subject: [EXT] Re: Faceting with a multi valued field

What specifically do you control? Just keyword (and "Communities:"
part is locked?) or anything after q= or anything that allows multiple variables?

Because if you could isolate search value, you could use for example facet.prefix, set in
solrconfig as a default parameter and populated from the same variable as the Communities
search.

You may also want to set facet.mincount=1 in solrconfig.xml to avoid 0-value facets in general:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_7-5F4_faceting.html&d=DwIBaQ&c=jdm1Hby_BzoqwoYzPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSNEuM3U&m=xAdIgtTdaZYLG3jsYsLQqWtQBb9-cHsyG58r_mvTm-E&s=RgNvfB_bRwAfe9NpY1HedFlSHUNY0QbZ4VCXTzduTMo&e=

Regards,
   Alex.


On 25 September 2018 at 16:50, John Blythe <johnblythe@gmail.com> wrote:
> you can update your filter query to be a facet query, this will apply 
> the query to the resulting facet set instead of the Communities field itself.
>
> --
> John Blythe
>
>
> On Tue, Sep 25, 2018 at 4:15 PM Hanjan, Harinder 
> <Harinder.Hanjan@calgary.ca>
> wrote:
>
>> Hello!
>>
>> I am doing faceting on a field which has multiple values and it's 
>> yielding expected but undesireable results. I need different 
>> behaviour but not sure how to formulate a query for it. Here is my current setup.
>>
>> ===== Data Set =====
>>   {
>> "Communities":["BANFF TRAIL - BNF", "PARKDALE - PKD"], "Document 
>> Type":"Engagement - What We Heard Report", "Navigation":"Livelink", 
>> "SolrId":"https://urldefense.proofpoint.com/v2/url?u=http-3A__thesimpsons.com_one&d=DwIBaQ&c=jdm1Hby_BzoqwoYzPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSNEuM3U&m=xAdIgtTdaZYLG3jsYsLQqWtQBb9-cHsyG58r_mvTm-E&s=-ZCoMFGNAEILlQOvY1Stra9dCF-rM48tZSTT3QJcOA0&e="
>>   }
>>   {
>> "Communities":["BANFF TRAIL - BNF", "PARKDALE - PKD"], "Document 
>> Type":"Engagement - What We Heard Report", "Navigation":"Livelink", 
>> "Id":"https://urldefense.proofpoint.com/v2/url?u=http-3A__thesimpsons.com_two&d=DwIBaQ&c=jdm1Hby_BzoqwoYzPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSNEuM3U&m=xAdIgtTdaZYLG3jsYsLQqWtQBb9-cHsyG58r_mvTm-E&s=_JPFUX0e0zqyJWHQzWH815ThZAsdGu5TwDSkXBIL23Q&e="
>>   }
>>   {
>> "Communities":["SUNALTA - SNA"],
>> "Document Type":"Engagement - What We Heard Report", 
>> "Navigation":"Livelink", 
>> "Id":"https://urldefense.proofpoint.com/v2/url?u=http-3A__thesimpsons.com_three&d=DwIBaQ&c=jdm1Hby_BzoqwoYzPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSNEuM3U&m=xAdIgtTdaZYLG3jsYsLQqWtQBb9-cHsyG58r_mvTm-E&s=scFc0GYxSyRaAiAmu4M3AvYNiMsgqffG1Jmko76YjH8&e="
>>   }
>>
>> ===== Query I run now =====
>>
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8984_
>> solr_everything_select-3Fq-3D-2A-3A-2A-26facet-3Don-26facet.field-3DC
>> ommunities-26fq-3DCommunities-3A-2522BANFF&d=DwIBaQ&c=jdm1Hby_BzoqwoY
>> zPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSN
>> EuM3U&m=xAdIgtTdaZYLG3jsYsLQqWtQBb9-cHsyG58r_mvTm-E&s=G7NJKKdDNh0wP5l
>> sjrSQnmbT77hUTSgx2giYBuQFdEI&e=
>> TRAIL - BNF"
>>
>>
>> ===== Results I get now =====
>> {
>>   ...
>>   "facet_counts":{
>>     "facet_queries":{},
>>     "facet_fields":{
>>       "Communities":[
>>         "BANFF TRAIL - BNF",2,
>>         "PARKDALE - PKD",2,
>>         "SUNALTA - SNA",0]},
>>    ...
>>
>> Notice that the Communities facet has 2 non zero results. I 
>> understand this is because I'm using fq to get only documents which 
>> contain BANFF TRAIL but those documents also contain PARKDALE.
>>
>> Now, I am using facets to drive navigation on my page. The business 
>> case is that user can select a community to get documents pertaining 
>> to that specific community only. This works with the query I have 
>> above. However, the facets results also contain other communities 
>> which then get displayed to the user. For example, with the query 
>> above, user will see both BANFF TRAIL and PARKDALE as selected values 
>> even though user only selected BANFF TRAIL. It's worthwhile noting 
>> that I have no control over the data being sent to Solr and can't change it.
>>
>> How can I formulate a query to ensure that when user selects BANFF 
>> TRAIL, only BANFF TRAIL is returned under Solr facets?
>>
>> Thanks!
>> Harinder
>>
>> ________________________________
>> NOTICE -
>> This communication is intended ONLY for the use of the person or 
>> entity named above and may contain information that is confidential 
>> or legally privileged. If you are not the intended recipient named 
>> above or a person responsible for delivering messages or 
>> communications to the intended recipient, YOU ARE HEREBY NOTIFIED 
>> that any use, distribution, or copying of this communication or any 
>> of the information contained in it is strictly prohibited. If you 
>> have received this communication in error, please notify us 
>> immediately by telephone and then destroy or delete this 
>> communication, or return it to us by mail if requested by us. The City of Calgary
thanks you for your attention and co-operation.
>>
Mime
View raw message