[ 
https://issues.apache.org/jira/browse/SOLR-4215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ryan McKinley updated SOLR-4215:
--------------------------------

    Attachment: SOLR-4215-check-single-valued.patch

This patch overrides the multiToken flag when:
{code:java}
     boolean multiToken = sf.multiValued() || ft.multiValuedFieldCache();
+    if(multiToken) {
+      // Check if the index is really multi-valued
+      Terms terms = searcher.getAtomicReader().terms(field);
+      long size = terms.size();
+      if(size == terms.getSumDocFreq() &&
+         size == terms.getDocCount() &&
+         size > 0) {
+        multiToken = false;
+      }
+    }

{code}

TestFaceting.java passes.... I can't get the other tests to pass on my computer 
so i don't really know about the rest :(

Removing:
{code}
size == terms.getDocCount() &&
{code}
from the check makes testFacets 'check many tokens' fail

                
> Optimize facets when multi-valued field is really single valued
> ---------------------------------------------------------------
>
>                 Key: SOLR-4215
>                 URL: https://issues.apache.org/jira/browse/SOLR-4215
>             Project: Solr
>          Issue Type: Improvement
>          Components: SearchComponents - other
>            Reporter: Ryan McKinley
>            Priority: Minor
>             Fix For: 4.1
>
>         Attachments: SOLR-4215-check-single-valued.patch
>
>
> In lucene 4+, the Terms interface can quickly tell us if the index is 
> actually single-valued.  We should use that for better facet performance with 
> multi-valued fields (when they are actually single valued)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to