lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1145645 [2/2] - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/backwards/src/test-framework/ lucene/backwards/src/test/ lucene/backwards/src/test/org/apache/lucene/index/ lucene/contrib/demo/src/java/org/apache/luce...
Date Tue, 12 Jul 2011 16:12:51 GMT
Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestOmitTf.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestOmitTf.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestOmitTf.java
Tue Jul 12 16:12:49 2011
@@ -26,13 +26,8 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Collector;
-import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.Similarity;
-import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.search.*;
 import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.search.Explanation.IDFExplanation;
@@ -75,7 +70,7 @@ public class TestOmitTf extends LuceneTe
        
     // this field will NOT have Tf
     Field f2 = newField("f2", "This field has NO Tf in all docs", Field.Store.NO, Field.Index.ANALYZED);
-    f2.setOmitTermFreqAndPositions(true);
+    f2.setIndexOptions(IndexOptions.DOCS_ONLY);
     d.add(f2);
         
     writer.addDocument(d);
@@ -85,10 +80,10 @@ public class TestOmitTf extends LuceneTe
     d = new Document();
         
     // Reverese
-    f1.setOmitTermFreqAndPositions(true);
+    f1.setIndexOptions(IndexOptions.DOCS_ONLY);
     d.add(f1);
         
-    f2.setOmitTermFreqAndPositions(false);        
+    f2.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);        
     d.add(f2);
         
     writer.addDocument(d);
@@ -99,8 +94,8 @@ public class TestOmitTf extends LuceneTe
 
     SegmentReader reader = SegmentReader.getOnlySegmentReader(ram);
     FieldInfos fi = reader.fieldInfos();
-    assertTrue("OmitTermFreqAndPositions field bit should be set.", fi.fieldInfo("f1").omitTermFreqAndPositions);
-    assertTrue("OmitTermFreqAndPositions field bit should be set.", fi.fieldInfo("f2").omitTermFreqAndPositions);
+    assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY,
fi.fieldInfo("f1").indexOptions);
+    assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY,
fi.fieldInfo("f2").indexOptions);
         
     reader.close();
     ram.close();
@@ -126,7 +121,7 @@ public class TestOmitTf extends LuceneTe
        
     // this field will NOT have Tf
     Field f2 = newField("f2", "This field has NO Tf in all docs", Field.Store.NO, Field.Index.ANALYZED);
-    f2.setOmitTermFreqAndPositions(true);
+    f2.setIndexOptions(IndexOptions.DOCS_ONLY);
     d.add(f2);
 
     for(int i=0;i<30;i++)
@@ -137,10 +132,10 @@ public class TestOmitTf extends LuceneTe
     d = new Document();
         
     // Reverese
-    f1.setOmitTermFreqAndPositions(true);
+    f1.setIndexOptions(IndexOptions.DOCS_ONLY);
     d.add(f1);
         
-    f2.setOmitTermFreqAndPositions(false);        
+    f2.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);        
     d.add(f2);
         
     for(int i=0;i<30;i++)
@@ -153,8 +148,8 @@ public class TestOmitTf extends LuceneTe
 
     SegmentReader reader = SegmentReader.getOnlySegmentReader(ram);
     FieldInfos fi = reader.fieldInfos();
-    assertTrue("OmitTermFreqAndPositions field bit should be set.", fi.fieldInfo("f1").omitTermFreqAndPositions);
-    assertTrue("OmitTermFreqAndPositions field bit should be set.", fi.fieldInfo("f2").omitTermFreqAndPositions);
+    assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY,
fi.fieldInfo("f1").indexOptions);
+    assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY,
fi.fieldInfo("f2").indexOptions);
         
     reader.close();
     ram.close();
@@ -185,7 +180,7 @@ public class TestOmitTf extends LuceneTe
     for(int i=0;i<5;i++)
       writer.addDocument(d);
 
-    f2.setOmitTermFreqAndPositions(true);
+    f2.setIndexOptions(IndexOptions.DOCS_ONLY);
         
     for(int i=0;i<20;i++)
       writer.addDocument(d);
@@ -198,8 +193,8 @@ public class TestOmitTf extends LuceneTe
 
     SegmentReader reader = SegmentReader.getOnlySegmentReader(ram);
     FieldInfos fi = reader.fieldInfos();
-    assertTrue("OmitTermFreqAndPositions field bit should not be set.", !fi.fieldInfo("f1").omitTermFreqAndPositions);
-    assertTrue("OmitTermFreqAndPositions field bit should be set.", fi.fieldInfo("f2").omitTermFreqAndPositions);
+    assertEquals("OmitTermFreqAndPositions field bit should not be set.", IndexOptions.DOCS_AND_FREQS_AND_POSITIONS,
fi.fieldInfo("f1").indexOptions);
+    assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY,
fi.fieldInfo("f2").indexOptions);
         
     reader.close();
     ram.close();
@@ -207,8 +202,10 @@ public class TestOmitTf extends LuceneTe
 
   private void assertNoPrx(Directory dir) throws Throwable {
     final String[] files = dir.listAll();
-    for(int i=0;i<files.length;i++)
+    for(int i=0;i<files.length;i++) {
       assertFalse(files[i].endsWith(".prx"));
+      assertFalse(files[i].endsWith(".pos"));
+    }
   }
 
   // Verifies no *.prx exists when all fields omit term freq:
@@ -222,8 +219,8 @@ public class TestOmitTf extends LuceneTe
     lmp.setUseCompoundFile(false);
     Document d = new Document();
         
-    Field f1 = newField("f1", "This field has term freqs", Field.Store.NO, Field.Index.ANALYZED);
-    f1.setOmitTermFreqAndPositions(true);
+    Field f1 = newField("f1", "This field has no term freqs", Field.Store.NO, Field.Index.ANALYZED);
+    f1.setIndexOptions(IndexOptions.DOCS_ONLY);
     d.add(f1);
 
     for(int i=0;i<30;i++)
@@ -232,7 +229,15 @@ public class TestOmitTf extends LuceneTe
     writer.commit();
 
     assertNoPrx(ram);
-        
+    
+    // now add some documents with positions, and check there is no prox after optimization
+    d = new Document();
+    f1 = newField("f1", "This field has positions", Field.Store.NO, Field.Index.ANALYZED);
+    d.add(f1);
+    
+    for(int i=0;i<30;i++)
+      writer.addDocument(d);
+ 
     // force merge
     writer.optimize();
     // flush
@@ -262,7 +267,7 @@ public class TestOmitTf extends LuceneTe
       sb.append(term).append(" ");
       String content  = sb.toString();
       Field noTf = newField("noTf", content + (i%2==0 ? "" : " notf"), Field.Store.NO, Field.Index.ANALYZED);
-      noTf.setOmitTermFreqAndPositions(true);
+      noTf.setIndexOptions(IndexOptions.DOCS_ONLY);
       d.add(noTf);
           
       Field tf = newField("tf", content + (i%2==0 ? " tf" : ""), Field.Store.NO, Field.Index.ANALYZED);

Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Tue Jul 12 16:12:49 2011
@@ -49,6 +49,8 @@ New Features
   before adding to the index.  Fix a null pointer exception in logging
   when there was no unique key. (David Smiley via yonik)
 
+* LUCENE-2048: Added omitPositions to the schema, so you can omit position
+  information while still indexing term frequencies.  (rmuir)
 
 Optimizations
 ----------------------

Modified: lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/luke/FieldFlag.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/luke/FieldFlag.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/luke/FieldFlag.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/luke/FieldFlag.java
Tue Jul 12 16:12:49 2011
@@ -31,6 +31,7 @@ public enum FieldFlag {
   TERM_VECTOR_POSITION('p', "Store Position With TermVector"),
   OMIT_NORMS('O', "Omit Norms"), 
   OMIT_TF('F', "Omit Tf"), 
+  OMIT_POSITIONS('P', "Omit Positions"),
   LAZY('L', "Lazy"), 
   BINARY('B', "Binary"), 
   SORT_MISSING_FIRST('f', "Sort Missing First"), 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
Tue Jul 12 16:12:49 2011
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermEnum;
@@ -197,7 +198,10 @@ public class LukeRequestHandler extends 
     flags.append( (f != null && f.storeTermOffsets() )   ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation()
: '-' );
     flags.append( (f != null && f.storeTermPositions() ) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation()
: '-' );
     flags.append( (f != null && f.omitNorms())           ? FieldFlag.OMIT_NORMS.getAbbreviation()
: '-' );
-    flags.append( (f != null && f.omitTf())              ? FieldFlag.OMIT_TF.getAbbreviation()
: '-' );
+    flags.append( (f != null && 
+        f.indexOptions() == IndexOptions.DOCS_ONLY)      ? FieldFlag.OMIT_TF.getAbbreviation()
: '-' );
+    flags.append( (f != null && 
+        f.indexOptions() == IndexOptions.DOCS_AND_FREQS) ? FieldFlag.OMIT_POSITIONS.getAbbreviation()
: '-' );
     flags.append( (lazy)                                 ? FieldFlag.LAZY.getAbbreviation()
: '-' );
     flags.append( (binary)                               ? FieldFlag.BINARY.getAbbreviation()
: '-' );
     flags.append( (f != null && f.sortMissingFirst() )   ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation()
: '-' );

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldProperties.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldProperties.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldProperties.java
Tue Jul 12 16:12:49 2011
@@ -47,13 +47,14 @@ public abstract class FieldProperties {
   protected final static int SORT_MISSING_LAST   = 0x00000800;
   
   protected final static int REQUIRED            = 0x00001000;
+  protected final static int OMIT_POSITIONS      = 0x00002000;
   
   static final String[] propertyNames = {
           "indexed", "tokenized", "stored",
           "binary", "omitNorms", "omitTermFreqAndPositions",
           "termVectors", "termPositions", "termOffsets",
           "multiValued",
-          "sortMissingFirst","sortMissingLast","required"
+          "sortMissingFirst","sortMissingLast","required", "omitPositions"
   };
 
   static final Map<String,Integer> propertyMap = new HashMap<String,Integer>();

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java Tue
Jul 12 16:12:49 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TermRangeQuery;
@@ -241,7 +242,7 @@ public abstract class FieldType extends 
 
     return createField(field.getName(), val, getFieldStore(field, val),
             getFieldIndex(field, val), getFieldTermVec(field, val), field.omitNorms(),
-            field.omitTf(), boost);
+            field.indexOptions(), boost);
   }
 
 
@@ -259,14 +260,14 @@ public abstract class FieldType extends 
    * @return the {@link org.apache.lucene.document.Field}.
    */
   protected Fieldable createField(String name, String val, Field.Store storage, Field.Index
index,
-                                    Field.TermVector vec, boolean omitNorms, boolean omitTFPos,
float boost){
+                                    Field.TermVector vec, boolean omitNorms, IndexOptions
options, float boost){
     Field f = new Field(name,
                         val,
                         storage,
                         index,
                         vec);
     f.setOmitNorms(omitNorms);
-    f.setOmitTermFreqAndPositions(omitTFPos);
+    f.setIndexOptions(options);
     f.setBoost(boost);
     return f;
   }

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java Tue
Jul 12 16:12:49 2011
@@ -18,6 +18,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.IndexReader;
 
 import org.apache.lucene.search.*;
@@ -78,7 +79,7 @@ public class LatLonType extends Abstract
     if (field.stored()) {
       f[f.length - 1] = createField(field.getName(), externalVal,
               getFieldStore(field, externalVal), Field.Index.NO, Field.TermVector.NO,
-              false, false, boost);
+              false, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, boost);
     }
     return f;
   }

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/PointType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/PointType.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/PointType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/PointType.java Tue
Jul 12 16:12:49 2011
@@ -19,6 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
@@ -90,7 +91,7 @@ public class PointType extends Coordinat
       String storedVal = externalVal;  // normalize or not?
       f[f.length - 1] = createField(field.getName(), storedVal,
                 getFieldStore(field, storedVal), Field.Index.NO, Field.TermVector.NO,
-                false, false, boost);
+                false, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, boost);
     }
     
     return f;

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java Tue
Jul 12 16:12:49 2011
@@ -20,6 +20,7 @@ package org.apache.solr.schema;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.search.SortField;
 import org.apache.solr.search.QParser;
 
@@ -82,7 +83,17 @@ public final class SchemaField extends F
   public boolean storeTermPositions() { return (properties & STORE_TERMPOSITIONS)!=0;
}
   public boolean storeTermOffsets() { return (properties & STORE_TERMOFFSETS)!=0; }
   public boolean omitNorms() { return (properties & OMIT_NORMS)!=0; }
-  public boolean omitTf() { return (properties & OMIT_TF_POSITIONS)!=0; }
+
+  public IndexOptions indexOptions() { 
+    if ((properties & OMIT_TF_POSITIONS) != 0) {
+      return IndexOptions.DOCS_ONLY;
+    } else if ((properties & OMIT_POSITIONS) != 0) {
+      return IndexOptions.DOCS_AND_FREQS;
+    } else {
+      return IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+    }
+  }
+
   public boolean multiValued() { return (properties & MULTIVALUED)!=0; }
   public boolean sortMissingFirst() { return (properties & SORT_MISSING_FIRST)!=0; }
   public boolean sortMissingLast() { return (properties & SORT_MISSING_LAST)!=0; }
@@ -222,7 +233,7 @@ public final class SchemaField extends F
     }
 
     if (on(falseProps,INDEXED)) {
-      int pp = (INDEXED | OMIT_NORMS | OMIT_TF_POSITIONS
+      int pp = (INDEXED | OMIT_NORMS | OMIT_TF_POSITIONS | OMIT_POSITIONS
               | STORE_TERMVECTORS | STORE_TERMPOSITIONS | STORE_TERMOFFSETS
               | SORT_MISSING_FIRST | SORT_MISSING_LAST);
       if (on(pp,trueProps)) {
@@ -232,6 +243,14 @@ public final class SchemaField extends F
 
     }
 
+    if (on(falseProps,OMIT_TF_POSITIONS)) {
+      int pp = (OMIT_POSITIONS | OMIT_TF_POSITIONS);
+      if (on(pp, trueProps)) {
+        throw new RuntimeException("SchemaField: " + name + " conflicting indexed field options:"
+ props);
+      }
+      p &= ~pp;
+    }
+
     if (on(falseProps,STORE_TERMVECTORS)) {
       int pp = (STORE_TERMVECTORS | STORE_TERMPOSITIONS | STORE_TERMOFFSETS);
       if (on(pp,trueProps)) {

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java Tue
Jul 12 16:12:49 2011
@@ -19,6 +19,7 @@ package org.apache.solr.schema;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.NumericField;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.NumericUtils;
 import org.apache.lucene.analysis.TokenStream;
@@ -390,7 +391,7 @@ public class TrieField extends FieldType
     }
 
     f.setOmitNorms(field.omitNorms());
-    f.setOmitTermFreqAndPositions(field.omitTf());
+    f.setIndexOptions(field.indexOptions());
     f.setBoost(boost);
     return f;
   }

Modified: lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml?rev=1145645&r1=1145644&r2=1145645&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml Tue Jul 12 16:12:49
2011
@@ -390,6 +390,13 @@
 
   <fieldType name="latLon" class="solr.LatLonType" subFieldType="double"/>
 
+  
+  <!-- omitPositions example -->
+  <fieldType name="nopositions" class="solr.TextField" omitPositions="true">
+    <analyzer>
+      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
+    </analyzer>
+  </fieldType>
  </types>
 
 
@@ -495,6 +502,8 @@
    <field name="multiDefault" type="string" indexed="true" stored="true" default="muLti-Default"
multiValued="true"/>
    <field name="intDefault" type="int" indexed="true" stored="true" default="42" multiValued="false"/>
 
+   
+   <field name="nopositionstext" type="nopositions" indexed="true" stored="true"/>
 
    <field name="tlong" type="tlong" indexed="true" stored="true" />
 

Copied: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/schema/TestOmitPositions.java
(from r1145594, lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestOmitPositions.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/schema/TestOmitPositions.java?p2=lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/schema/TestOmitPositions.java&p1=lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestOmitPositions.java&r1=1145594&r2=1145645&rev=1145645&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestOmitPositions.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/schema/TestOmitPositions.java
Tue Jul 12 16:12:49 2011
@@ -43,18 +43,10 @@ public class TestOmitPositions extends S
   public void testPositions() {
     // no results should be found:
     // lucene 3.x: silent failure
-    // lucene 4.x: illegal state exception, field was indexed without positions
-    
-    ignoreException("was indexed without position data");
-    try {
+
     assertQ("phrase query: ",
        req("fl", "id", "q", "nopositionstext:\"test test\""),
               "//*[@numFound='0']"
     );
-    } catch (Exception expected) {
-      assertTrue(expected.getCause() instanceof IllegalStateException);
-      // in lucene 4.0, queries don't silently fail
-    }
-    resetExceptionIgnores();
   }
 }



Mime
View raw message