[ 
https://issues.apache.org/jira/browse/SOLR-13056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16717674#comment-16717674
 ] 

Hoss Man commented on SOLR-13056:
---------------------------------

bq. Maybe we need to have multiple analyzer-chains for the same field 
(SOLR-11917?).

Even if we had multiple analyzer chains, the bottom line is that facet 
rfinement shouldn't be using *ANY* analysis -- it already knows it has a facet 
"term" the refinement should just do a query directly on that "term"...

Per my comment in SOLR-11916 ...
bq. ... frankly it seems like (IIUC) the real "bug" is is that the faceting 
code doesn't do it's refinement queries in a way that ensures a direct "Term" 
query (and the field type doesn't know the context of what it's being asked for 
during refinement, so it builds a PhraseQuery) – ie: i'm guessing you'd see the 
exact same "bug" if you faceted on a TextField where the index analyzer used 
KeywordTokenizer but the query analyzer using WhitespaceTokenizer ... but this 
is a conversation that should be had in a new jira.

...i'm not looking a the code right now, and i havne't thought about it that 
hard, but i suspect the ideal fix would go along one these two lines
* change the facet code to use something like FieldType.readableToIndexed to 
build a raw term value and construct the TermQuery or DocValuesQuery directly
** Better: change the facet code to use TermQParser directly -- (and fix 
TermQParser if it isn't already smart enough to deal with indexed=false 
docValues=true fields fields)
* change the FieldType.getFieldQuery impls to look for context information (via 
the QParser) indicating that this is a "raw term" situation and have the facet 
refinement code pass that context

...analysis should never factor into it.


> SortableTextField is trappy for faceting
> ----------------------------------------
>
>                 Key: SOLR-13056
>                 URL: https://issues.apache.org/jira/browse/SOLR-13056
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: search
>    Affects Versions: 7.6
>            Reporter: Toke Eskildsen
>            Priority: Major
>
> Using {{SortableTextField}} for distributed faceting can lead to wrong 
> results. This can be demonstrated by installing the cloud-version of the 
> {{gettingstarted}} sample with
> {{./solr -e cloud}}
> using defaults all the way, except for {{shards}} which should be {{3}}. 
> After that a corpus can be indexed with
> {{( echo '[' ; for J in $(seq 0 99); do ID=$((J)) ; echo 
> "\{\"id\":\"$ID\",\"facet_t_sort\":\"a b $J\"},"; done ; echo 
> '\{"id":"duplicate_1","facet_t_sort":"a 
> b"},\{"id":"duplicate_2","facet_t_sort":"a b"}]' ) | curl -s -d @- -X POST -H 
> 'Content-Type: application/json' 
> 'http://localhost:8983/solr/gettingstarted/update?commit=true'}}
> This will index 100 documents with a single-valued field {{facet_t_sort:"a b 
> X"}} where X is the document number + 2 documents with {{facet_t_sort:"a 
> b"}}. The call
> {{curl 
> 'http://localhost:8983/solr/gettingstarted/select?facet.field=facet_t_sort&facet.limit=5&facet=on&q=**:**&rows=0'}}
> should return "a b" as the top facet term with count 2, but returns
> {{ {}}
> {{ "responseHeader":{}}
> {{ "zkConnected":true,}}
> {{ "status":0,}}
> {{ "QTime":13,}}
> {{ "params":{}}
> {{ "facet.limit":"5",}}
> {{ "q":":",}}
> {{ "facet.field":"facet_t_sort",}}
> {{ "rows":"0",}}
> {{ "facet":"on"} },}}
> {{ "response":{"numFound":102,"start":0,"maxScore":1.0,"docs":[]}}
> {{ },}}
> {{ "facet_counts":{}}
> {{ "facet_queries":{},}}
> {{ "facet_fields":{}}
> {{ "facet_t_sort":[}}
> {{ "a b",36,}}
> {{ "a b 0",1,}}
> {{ "a b 1",1,}}
> {{ "a b 10",1,}}
> {{ "a b 11",1]},}}
> {{ "facet_ranges":{},}}
> {{ "facet_intervals":{},}}
> {{ "facet_heatmaps":{} } } }}
> The problem is the second phase of simple faceting, where the fine-counting 
> happens. In the first phase, "a b" is returned from 1 or 2 of the 3 shards. 
> It wins the popularity contest as there are 2 "a b"-terms and only 1 of all 
> the other terms. The 1 or 2 shards that did not deliver "a b" in the first 
> phase are then queried for the count for "a b", which happens in the form of 
> a {{facet_t_sort:"a b"}}-lookup. It seems that this lookup uses the analyzer 
> chain and thus matches _all_ the documents in that shard (approximately 
> 102/3).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to