You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2013/10/24 15:55:08 UTC

svn commit: r1535383 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/index/ solr/ solr/core/ solr/core/src/java/org/apache/solr/request/ solr/core/src/test/org/apache/solr/

Author: jpountz
Date: Thu Oct 24 13:55:07 2013
New Revision: 1535383

URL: http://svn.apache.org/r1535383
Log:
LUCENE-5304: SingletonSortedSetDocValues can now return the wrapped SortedDocValues

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SingletonSortedSetDocValues.java
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java

Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1535383&r1=1535382&r2=1535383&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Thu Oct 24 13:55:07 2013
@@ -62,6 +62,9 @@ New Features
 * LUCENE-5274: FastVectorHighlighter now supports highlighting against several
   indexed fields. (Nik Everett via Adrien Grand)
 
+* LUCENE-5304: SingletonSortedSetDocValues can now return the wrapped
+  SortedDocValues (Robert Muir, Adrien Grand)
+
 Bug Fixes
 
 * LUCENE-4998: Fixed a few places to pass IOContext.READONCE instead

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SingletonSortedSetDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SingletonSortedSetDocValues.java?rev=1535383&r1=1535382&r2=1535383&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SingletonSortedSetDocValues.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/SingletonSortedSetDocValues.java Thu Oct 24 13:55:07 2013
@@ -37,6 +37,11 @@ public class SingletonSortedSetDocValues
     assert NO_MORE_ORDS == -1; // this allows our nextOrd() to work for missing values without a check
   }
 
+  /** Return the wrapped {@link SortedDocValues} */
+  public SortedDocValues getSortedDocValues() {
+    return in;
+  }
+
   @Override
   public long nextOrd() {
     if (set) {

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1535383&r1=1535382&r2=1535383&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Thu Oct 24 13:55:07 2013
@@ -106,6 +106,9 @@ Optimizations
 
 * SOLR-5370: Requests to recover when an update fails should be done in 
   background threads. (Mark Miller)
+
+* LUCENE-5300,LUCENE-5304: Specialized faceting for fields which are declared as
+  multi-valued in the schema but are actually single-valued. (Adrien Grand)
   
 Security
 ----------------------

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java?rev=1535383&r1=1535382&r2=1535383&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java Thu Oct 24 13:55:07 2013
@@ -131,7 +131,13 @@ public class DocValuesFacets {
             if (sub == null) {
               sub = SortedSetDocValues.EMPTY;
             }
-            accumMulti(counts, startTermIndex, sub, disi, subIndex, ordinalMap);
+            if (sub instanceof SingletonSortedSetDocValues) {
+              // some codecs may optimize SORTED_SET storage for single-valued fields
+              final SortedDocValues values = ((SingletonSortedSetDocValues) sub).getSortedDocValues();
+              accumSingle(counts, startTermIndex, values, disi, subIndex, ordinalMap);
+            } else {
+              accumMulti(counts, startTermIndex, sub, disi, subIndex, ordinalMap);
+            }
           } else {
             SortedDocValues sub = leaf.reader().getSortedDocValues(fieldName);
             if (sub == null) {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java?rev=1535383&r1=1535382&r2=1535383&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java Thu Oct 24 13:55:07 2013
@@ -66,6 +66,7 @@ public class TestRandomDVFaceting extend
     types.add(new FldType("small2_s",ZERO_ONE, new SVal('a',(char)('c'+indexSize/3),1,1)));
     types.add(new FldType("small2_ss",ZERO_TWO, new SVal('a',(char)('c'+indexSize/3),1,1)));
     types.add(new FldType("small3_ss",new IRange(0,25), new SVal('A','z',1,1)));
+    types.add(new FldType("small4_ss",ZERO_ONE, new SVal('a',(char)('c'+indexSize/3),1,1))); // to test specialization when a multi-valued field is actually single-valued
     types.add(new FldType("small_i",ZERO_ONE, new IRange(0,5+indexSize/3)));
     types.add(new FldType("small2_i",ZERO_ONE, new IRange(0,5+indexSize/3)));
     types.add(new FldType("small2_is",ZERO_TWO, new IRange(0,5+indexSize/3)));