One of the most valuable things I did when I started out (way back in the Lucene-only days) was try to answer _one_ question every so often. Even if someone else beat me to the punch, I benefitted from the research. And the rest of the time I discovered things I never knew about Solr/Lucene!
I think one of the most valuable lessons was "Somebody's probably run into this before, I wonder what _they_ did?" ;) Best, Erick On Thu, Jun 2, 2016 at 9:46 PM, MaryJo Sminkey <mjsmin...@gmail.com> wrote: > Well thanks for asking the question because I had no idea what Andrew > posted was even possible... and I most definitely will be using that > myself! Totally brilliant stuff. I am so loving Solr... well, when it's not > driving me bonkers. > > Mary Jo > > > On Thu, Jun 2, 2016 at 2:33 PM, Jamal, Sarfaraz < > sarfaraz.ja...@verizonwireless.com.invalid> wrote: > >> Thank you Andrew, that looks like exactly what I am looking for =) >> Thank you Robert, it looks like we are both doing it in similar fashion =) >> Thank you MaryJo for jumping right in! >> >> Sas >> >> >> >> -----Original Message----- >> From: Andrew Chillrud [mailto:achill...@opentext.com] >> Sent: Thursday, June 2, 2016 2:17 PM >> To: solr-user@lucene.apache.org >> Subject: RE: [E] Re: Faceting Question(s) >> >> It is possible to get the original facet counts for the field you are >> filtering on (we have been using this since Solr 3.6). Don't know if this >> can be extended to get the original counts for all fields however. >> >> This syntax is described here: >> https://cwiki.apache.org/confluence/display/solr/Faceting >> >> Tagging and Excluding Filters >> >> You can tag specific filters and exclude those filters when faceting. This >> is useful when doing multi-select faceting. >> >> Consider the following example query with faceting: >> >> q=mainquery&fq=status:public&fq=doctype:pdf&facet=true&facet.field=doctype >> >> Because everything is already constrained by the filter doctype:pdf, the >> facet.field=doctype facet command is currently redundant and will return 0 >> counts for everything except doctype:pdf. >> >> To implement a multi-select facet for doctype, a GUI may want to still >> display the other doctype values and their associated counts, as if the >> doctype:pdf constraint had not yet been applied. For example: >> === Document Type === >> [ ] Word (42) >> [x] PDF (96) >> [ ] Excel(11) >> [ ] HTML (63) >> >> To return counts for doctype values that are currently not selected, tag >> filters that directly constrain doctype, and exclude those filters when >> faceting on doctype. >> >> >> q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&facet=true&facet.field={!ex=dt}doctype >> >> Filter exclusion is supported for all types of facets. Both the tag and ex >> local parameters may specify multiple values by separating them with commas. >> >> - Andy - >> >> -----Original Message----- >> From: Robert Brown [mailto:r...@intelcompute.com] >> Sent: Thursday, June 02, 2016 2:12 PM >> To: solr-user@lucene.apache.org >> Subject: Re: [E] Re: Faceting Question(s) >> >> MaryJo, I think you've mis-understood. The counts are different simply >> because the 2nd query contains an filter of a facet value from the 1st >> query - that's completely expected. >> >> The issue is how to get the original facet counts (with no filters but >> same q) in the same call as also filtering by one of those facet values. >> >> Personally I don't think it's possible, but will be interested to hear >> others input, since it's a very common situation for me - I cache the first >> result in memcached and tag future queries as related to the first. >> >> Or could you always make 2 calls back to Solr (one original (again), and >> one with the filters), the caches should help massively. >> >> >> >> On 02/06/16 19:07, MaryJo Sminkey wrote: >> > And you're saying the count for the second query is different than >> > what was returned in the facet? You may need to check for any defaults >> > you have set up in the solrconfig for the select parser, if for >> > instance you have any grouping going on, but aren't doing grouping in >> > your facet, that could result in the counts being off. >> > >> > MJ >> > >> > >> > >> > >> > On Thu, Jun 2, 2016 at 2:01 PM, Jamal, Sarfaraz < >> > sarfaraz.ja...@verizonwireless.com.invalid> wrote: >> > >> >> Absolutely, >> >> >> >> Here is what it looks like: >> >> >> >> This brings the right counts as it should http:// >> >> **********select?q=video&hl=true&hl.fl=*&hl.snippets=20&facet=true&fa >> >> cet.field=team >> >> >> >> Then when I specify which team >> >> http:// >> >> **********select?q=video&hl=true&hl.fl=*&hl.snippets=20&facet=true&fa >> >> cet.field=team&fq=team:rollback >> >> >> >> The counts are obviously different now, as the result set is limited >> >> to one team. >> >> >> >> Sas >> >> >> >> -----Original Message----- >> >> From: MaryJo Sminkey [mailto:mjsmin...@gmail.com] >> >> Sent: Thursday, June 2, 2016 1:56 PM >> >> To: solr-user@lucene.apache.org >> >> Subject: [E] Re: Faceting Question(s) >> >> >> >> Jamai - what is your q= set to? And do you have a fq for the original >> >> query? I have found that if you do a wildcard search (*.*) you have >> >> to be careful about other parameters you set as that can often result >> >> in the numbers returned being off. In my case, my defaults had things >> >> like edismax settings for phrase boosting, etc. that don't apply if >> >> there isn't a search term, and once I removed those for a wildcard >> >> search I got the correct numbers. So possibly your facet query itself >> >> may be set up correctly but something else in the parameters and/or >> >> filters with the two queries may be the cause of the difference. >> >> >> >> Mary Jo >> >> >> >> >> >> On Thu, Jun 2, 2016 at 1:47 PM, Jamal, Sarfaraz < >> >> sarfaraz.ja...@verizonwireless.com.invalid> wrote: >> >> >> >>> Hello Everyone, >> >>> >> >>> I am working on implementing some basic faceting into my project. >> >>> >> >>> I have it working the way I want to, but I feel like there is >> >>> probably a better way the way I went about it. >> >>> >> >>> * I want to show a category and its count. >> >>> * when someone clicks a category, it sets a FQ= to that category. >> >>> >> >>> But now that the results are being filtered, the category counts >> >>> from the original query without the filters are off. >> >>> >> >>> So, I have a single api call that I make with rows set to 0 and the >> >>> base query without any filters, and use that to display my categories. >> >>> >> >>> And then I call the api again, this time to get the results. And the >> >>> category count is the same. >> >>> >> >>> I hope that makes sense. >> >>> >> >>> I was hoping facet.query would be of help, but I am not sure I >> >>> understood it properly. >> >>> >> >>> Thanks in advance =) >> >>> >> >>> Sas >> >>> >> >>