jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r486281 - in /jackrabbit/trunk/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/query/lucene/ src/main/javacc/fulltext/
Date Tue, 12 Dec 2006 19:12:29 GMT
Author: jukka
Date: Tue Dec 12 11:12:28 2006
New Revision: 486281

URL: http://svn.apache.org/viewvc?view=rev&rev=486281
Log:
JCR-352: Applied the Lucene 2.0 upgrade patch contributed by Przemo Pakulski.

Modified:
    jackrabbit/trunk/jackrabbit-core/pom.xml
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeScan.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java
    jackrabbit/trunk/jackrabbit-core/src/main/javacc/fulltext/QueryParser.jjt

Modified: jackrabbit/trunk/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/pom.xml?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/pom.xml Tue Dec 12 11:12:28 2006
@@ -310,9 +310,9 @@
       <version>1.0</version>
     </dependency>
     <dependency>
-      <groupId>lucene</groupId>
-      <artifactId>lucene</artifactId>
-      <version>1.4.3</version>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-core</artifactId>
+      <version>2.0.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.derby</groupId>

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
Tue Dec 12 11:12:28 2006
@@ -144,7 +144,7 @@
      * @return number of documents deleted
      */
     int removeDocument(Term idTerm) throws IOException {
-        return getIndexReader().delete(idTerm);
+        return getIndexReader().deleteDocuments(idTerm);
     }
 
     /**
@@ -207,12 +207,13 @@
         }
         if (indexWriter == null) {
             indexWriter = new IndexWriter(getDirectory(), analyzer, false);
-            indexWriter.minMergeDocs = minMergeDocs;
-            indexWriter.maxMergeDocs = maxMergeDocs;
-            indexWriter.mergeFactor = mergeFactor;
-            indexWriter.maxFieldLength = maxFieldLength;
+			// since lucene 2.0 setMaxBuffereDocs is equivalent to previous minMergeDocs attribute
+			indexWriter.setMaxBufferedDocs(minMergeDocs);
+            indexWriter.setMaxMergeDocs(maxMergeDocs);
+            indexWriter.setMergeFactor(mergeFactor);
+            indexWriter.setMaxFieldLength(maxFieldLength);
             indexWriter.setUseCompoundFile(useCompoundFile);
-            indexWriter.infoStream = STREAM_LOGGER;
+            indexWriter.setInfoStream(STREAM_LOGGER);
         }
         return indexWriter;
     }
@@ -322,7 +323,8 @@
     void setMinMergeDocs(int minMergeDocs) {
         this.minMergeDocs = minMergeDocs;
         if (indexWriter != null) {
-            indexWriter.minMergeDocs = minMergeDocs;
+			// since lucene 2.0 setMaxBuffereDocs is equivalent to previous minMergeDocs attribute
+			indexWriter.setMaxBufferedDocs(minMergeDocs);
         }
     }
 
@@ -332,7 +334,7 @@
     void setMaxMergeDocs(int maxMergeDocs) {
         this.maxMergeDocs = maxMergeDocs;
         if (indexWriter != null) {
-            indexWriter.maxMergeDocs = maxMergeDocs;
+            indexWriter.setMaxMergeDocs(maxMergeDocs);
         }
     }
 
@@ -342,7 +344,7 @@
     void setMergeFactor(int mergeFactor) {
         this.mergeFactor = mergeFactor;
         if (indexWriter != null) {
-            indexWriter.mergeFactor = mergeFactor;
+            indexWriter.setMergeFactor(mergeFactor);
         }
     }
 
@@ -352,7 +354,7 @@
     void setMaxFieldLength(int maxFieldLength) {
         this.maxFieldLength = maxFieldLength;
         if (indexWriter != null) {
-            indexWriter.maxFieldLength = maxFieldLength;
+            indexWriter.setMaxFieldLength(maxFieldLength);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
Tue Dec 12 11:12:28 2006
@@ -190,7 +190,7 @@
             return true;
         }
 
-        protected float difference() {
+        public float difference() {
             return 1.0f;
         }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java
Tue Dec 12 11:12:28 2006
@@ -19,8 +19,8 @@
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.Lock;
-import org.apache.lucene.store.OutputStream;
-import org.apache.lucene.store.InputStream;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.store.IndexInput;
 
 import java.io.IOException;
 import java.io.File;
@@ -156,9 +156,9 @@
     /**
      * @inheritDoc
      */
-    public OutputStream createFile(String name)
+    public IndexOutput createOutput(String name)
             throws IOException {
-        return delegatee.createFile(name);
+        return delegatee.createOutput(name);
     }
 
     /**
@@ -204,9 +204,9 @@
     /**
      * @inheritDoc
      */
-    public InputStream openFile(String name)
+    public IndexInput openInput(String name)
             throws IOException {
-        return delegatee.openFile(name);
+        return delegatee.openInput(name);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
Tue Dec 12 11:12:28 2006
@@ -55,6 +55,7 @@
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
@@ -204,7 +205,7 @@
         Object[] result = node.acceptOperands(this, null);
         for (int i = 0; i < result.length; i++) {
             Query operand = (Query) result[i];
-            orQuery.add(operand, false, false);
+            orQuery.add(operand, Occur.SHOULD);
         }
         return orQuery;
     }
@@ -217,7 +218,7 @@
         BooleanQuery andQuery = new BooleanQuery();
         for (int i = 0; i < result.length; i++) {
             Query operand = (Query) result[i];
-            andQuery.add(operand, true, false);
+            andQuery.add(operand, Occur.MUST);
         }
         return andQuery;
     }
@@ -230,7 +231,7 @@
         // join the results
         BooleanQuery b = new BooleanQuery();
         for (int i = 0; i < result.length; i++) {
-            b.add((Query) result[i], false, false);
+            b.add((Query) result[i], Occur.SHOULD);
         }
         // negate
         return new NotQuery(b);
@@ -311,7 +312,7 @@
         } else {
             BooleanQuery b = new BooleanQuery();
             for (Iterator it = terms.iterator(); it.hasNext();) {
-                b.add(new TermQuery((Term) it.next()), false, false);
+                b.add(new TermQuery((Term) it.next()), Occur.SHOULD);
             }
             return b;
         }
@@ -383,8 +384,8 @@
                                 || (!node.getReferencesProperty() && i == elements.length
- 1))) {
                         Query q = new TermQuery(new Term(FieldNames.LABEL, name));
                         BooleanQuery and = new BooleanQuery();
-                        and.add(q, true, false);
-                        and.add(context, true, false);
+                        and.add(q, Occur.MUST);
+                        and.add(context, Occur.MUST);
                         context = and;
                     } else if ((node.getReferencesProperty() && i < elements.length
- 2)
                             || (!node.getReferencesProperty() && i < elements.length
- 1)) {
@@ -429,8 +430,8 @@
                         exceptions.add(e);
                     }
                     BooleanQuery and = new BooleanQuery();
-                    and.add(new TermQuery(new Term(FieldNames.PARENT, "")), true, false);
-                    and.add(new TermQuery(new Term(FieldNames.LABEL, name)), true, false);
+                    and.add(new TermQuery(new Term(FieldNames.PARENT, "")), Occur.MUST);
+                    and.add(new TermQuery(new Term(FieldNames.LABEL, name)), Occur.MUST);
                     context = and;
                 }
                 LocationStepQueryNode[] tmp = new LocationStepQueryNode[steps.length - 1];
@@ -451,7 +452,7 @@
         if (data instanceof BooleanQuery) {
             BooleanQuery constraint = (BooleanQuery) data;
             if (constraint.getClauses().length > 0) {
-                constraint.add(context, true, false);
+                constraint.add(context, Occur.MUST);
                 context = constraint;
             }
         }
@@ -469,7 +470,7 @@
         // predicate on step?
         Object[] predicates = node.acceptOperands(this, data);
         for (int i = 0; i < predicates.length; i++) {
-            andQuery.add((Query) predicates[i], true, false);
+            andQuery.add((Query) predicates[i], Occur.MUST);
         }
 
         // check for position predicate
@@ -496,7 +497,7 @@
 
         if (node.getIncludeDescendants()) {
             if (nameTest != null) {
-                andQuery.add(new DescendantSelfAxisQuery(context, nameTest), true, false);
+                andQuery.add(new DescendantSelfAxisQuery(context, nameTest), Occur.MUST);
             } else {
                 // descendant-or-self with nametest=*
                 if (predicates.length > 0) {
@@ -509,7 +510,7 @@
                     if (pathNode.getPathSteps()[0] != node) {
                         Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                         andQuery = new BooleanQuery();
-                        andQuery.add(subQuery, true, false);
+                        andQuery.add(subQuery, Occur.MUST);
                     }
                 } else {
                     // todo this will traverse the whole index, optimize!
@@ -523,19 +524,19 @@
                     PathQueryNode pathNode = (PathQueryNode) node.getParent();
                     if (pathNode.getPathSteps()[0] != node) {
                         context = new DescendantSelfAxisQuery(context, subQuery);
-                        andQuery.add(new ChildAxisQuery(sharedItemMgr, context, null, node.getIndex()),
true, false);
+                        andQuery.add(new ChildAxisQuery(sharedItemMgr, context, null, node.getIndex()),
Occur.MUST);
                     } else {
-                        andQuery.add(subQuery, true, false);
+                        andQuery.add(subQuery, Occur.MUST);
                     }
                 }
             }
         } else {
             // name test
             if (nameTest != null) {
-                andQuery.add(new ChildAxisQuery(sharedItemMgr, context, nameTest.getTerm().text(),
node.getIndex()), true, false);
+                andQuery.add(new ChildAxisQuery(sharedItemMgr, context, nameTest.getTerm().text(),
node.getIndex()), Occur.MUST);
             } else {
                 // select child nodes
-                andQuery.add(new ChildAxisQuery(sharedItemMgr, context, null, node.getIndex()),
true, false);
+                andQuery.add(new ChildAxisQuery(sharedItemMgr, context, null, node.getIndex()),
Occur.MUST);
             }
         }
 
@@ -567,9 +568,9 @@
             if (predicates.length > 0) {
                 BooleanQuery andQuery = new BooleanQuery();
                 for (int i = 0; i < predicates.length; i++) {
-                    andQuery.add((Query) predicates[i], true, false);
+                    andQuery.add((Query) predicates[i], Occur.MUST);
                 }
-                andQuery.add(context, true, false);
+                andQuery.add(context, Occur.MUST);
                 context = andQuery;
             }
 
@@ -659,7 +660,7 @@
                     } else {
                         q = new TermQuery(t);
                     }
-                    or.add(q, false, false);
+                    or.add(q, Occur.SHOULD);
                 }
                 query = or;
                 if (node.getOperation() == QueryConstants.OPERATION_EQ_VALUE) {
@@ -672,7 +673,7 @@
                 for (int i = 0; i < stringValues.length; i++) {
                     Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
                     Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
"\uFFFF"));
-                    or.add(new RangeQuery(lower, upper, true, transform[0]), false, false);
+                    or.add(new RangeQuery(lower, upper, true, transform[0]), Occur.SHOULD);
                 }
                 query = or;
                 if (node.getOperation() == QueryConstants.OPERATION_GE_VALUE) {
@@ -685,7 +686,7 @@
                 for (int i = 0; i < stringValues.length; i++) {
                     Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
                     Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
"\uFFFF"));
-                    or.add(new RangeQuery(lower, upper, false, transform[0]), false, false);
+                    or.add(new RangeQuery(lower, upper, false, transform[0]), Occur.SHOULD);
                 }
                 query = or;
                 if (node.getOperation() == QueryConstants.OPERATION_GT_VALUE) {
@@ -698,7 +699,7 @@
                 for (int i = 0; i < stringValues.length; i++) {
                     Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
""));
                     Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
-                    or.add(new RangeQuery(lower, upper, true, transform[0]), false, false);
+                    or.add(new RangeQuery(lower, upper, true, transform[0]), Occur.SHOULD);
                 }
                 query = or;
                 if (node.getOperation() == QueryConstants.OPERATION_LE_VALUE) {
@@ -720,7 +721,7 @@
                 for (int i = 0; i < stringValues.length; i++) {
                     Term lower = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
""));
                     Term upper = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
-                    or.add(new RangeQuery(lower, upper, false, transform[0]), false, false);
+                    or.add(new RangeQuery(lower, upper, false, transform[0]), Occur.SHOULD);
                 }
                 query = or;
                 if (node.getOperation() == QueryConstants.OPERATION_LT_VALUE) {
@@ -730,7 +731,7 @@
             case QueryConstants.OPERATION_NE_VALUE:      // !=
                 // match nodes with property 'field' that includes svp and mvp
                 BooleanQuery notQuery = new BooleanQuery();
-                notQuery.add(new MatchAllQuery(field), false, false);
+                notQuery.add(new MatchAllQuery(field), Occur.SHOULD);
                 // exclude all nodes where 'field' has the term in question
                 for (int i = 0; i < stringValues.length; i++) {
                     Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
@@ -742,10 +743,10 @@
                     } else {
                         q = new TermQuery(t);
                     }
-                    notQuery.add(q, false, true);
+                    notQuery.add(q, Occur.MUST_NOT);
                 }
                 // and exclude all nodes where 'field' is multi valued
-                notQuery.add(new TermQuery(new Term(FieldNames.MVP, field)), false, true);
+                notQuery.add(new TermQuery(new Term(FieldNames.MVP, field)), Occur.MUST_NOT);
                 query = notQuery;
                 break;
             case QueryConstants.OPERATION_NE_GENERAL:    // !=
@@ -756,7 +757,7 @@
                 // minus the nodes that have a multi-valued property 'field' and
                 //    all values are equal to term in question
                 notQuery = new BooleanQuery();
-                notQuery.add(new MatchAllQuery(field), false, false);
+                notQuery.add(new MatchAllQuery(field), Occur.SHOULD);
                 for (int i = 0; i < stringValues.length; i++) {
                     // exclude the nodes that have the term and are single valued
                     Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(field,
stringValues[i]));
@@ -770,9 +771,9 @@
                     } else {
                         q = new TermQuery(t);
                     }
-                    and.add(q, true, false);
-                    and.add(svp, true, false);
-                    notQuery.add(and, false, true);
+                    and.add(q, Occur.MUST);
+                    and.add(svp, Occur.MUST);
+                    notQuery.add(and, Occur.MUST_NOT);
                 }
                 // todo above also excludes multi-valued properties that contain
                 //      multiple instances of only stringValues. e.g. text={foo, foo}
@@ -805,8 +806,8 @@
                         if (name != null) {
                             Query nameTest = new TermQuery(new Term(FieldNames.LABEL, name));
                             BooleanQuery and = new BooleanQuery();
-                            and.add(query, true, false);
-                            and.add(nameTest, true, false);
+                            and.add(query, Occur.MUST);
+                            and.add(nameTest, Occur.MUST);
                             query = and;
                         } else {
                             // otherwise the query can be used as is
@@ -855,8 +856,8 @@
         // only contains a single value. This works because q already restricts
         // the result to those nodes that have a property propName
         BooleanQuery and = new BooleanQuery();
-        and.add(q, true, false);
-        and.add(svp, true, false);
+        and.add(q, Occur.MUST);
+        and.add(svp, Occur.MUST);
         return and;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
Tue Dec 12 11:12:28 2006
@@ -127,19 +127,19 @@
 
         // special fields
         // UUID
-        doc.add(new Field(FieldNames.UUID, node.getNodeId().getUUID().toString(), true, true,
false));
+        doc.add(new Field(FieldNames.UUID, node.getNodeId().getUUID().toString(), Field.Store.YES,
Field.Index.UN_TOKENIZED, Field.TermVector.NO));
         try {
             // parent UUID
             if (node.getParentId() == null) {
                 // root node
-                doc.add(new Field(FieldNames.PARENT, "", true, true, false));
-                doc.add(new Field(FieldNames.LABEL, "", false, true, false));
+                doc.add(new Field(FieldNames.PARENT, "", Field.Store.YES, Field.Index.UN_TOKENIZED,
Field.TermVector.NO));
+                doc.add(new Field(FieldNames.LABEL, "", Field.Store.NO, Field.Index.UN_TOKENIZED,
Field.TermVector.NO));
             } else {
-                doc.add(new Field(FieldNames.PARENT, node.getParentId().toString(), true,
true, false));
+                doc.add(new Field(FieldNames.PARENT, node.getParentId().toString(), Field.Store.YES,
Field.Index.UN_TOKENIZED, Field.TermVector.NO));
                 NodeState parent = (NodeState) stateProvider.getItemState(node.getParentId());
                 NodeState.ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
                 String name = NameFormat.format(child.getName(), mappings);
-                doc.add(new Field(FieldNames.LABEL, name, false, true, false));
+                doc.add(new Field(FieldNames.LABEL, name, Field.Store.NO, Field.Index.UN_TOKENIZED,
Field.TermVector.NO));
             }
         } catch (NoSuchItemStateException e) {
             throwRepositoryException(e);
@@ -196,7 +196,7 @@
     private void addMVPName(Document doc, QName name) {
         try {
             String propName = NameFormat.format(name, mappings);
-            doc.add(new Field(FieldNames.MVP, propName, false, true, false));
+            doc.add(new Field(FieldNames.MVP, propName, Field.Store.NO, Field.Index.UN_TOKENIZED,
Field.TermVector.NO));
         } catch (NoPrefixDeclaredException e) {
             // will never happen, prefixes are created dynamically
         }
@@ -299,7 +299,7 @@
                 for (Iterator it = fields.keySet().iterator(); it.hasNext();) {
                     String field = (String) it.next();
                     Reader r = (Reader) fields.get(field);
-                    doc.add(Field.Text(field, r));
+                    doc.add(new Field(field, r));
                 }
             }
         } catch (Exception e) {
@@ -320,9 +320,9 @@
     protected void addBooleanValue(Document doc, String fieldName, Object internalValue)
{
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, internalValue.toString()),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -338,9 +338,9 @@
         long millis = ((Calendar) internalValue).getTimeInMillis();
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, DateField.timeToString(millis)),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -356,9 +356,9 @@
         double doubleVal = ((Double) internalValue).doubleValue();
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, DoubleField.doubleToString(doubleVal)),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -374,9 +374,9 @@
         long longVal = ((Long) internalValue).longValue();
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, LongField.longToString(longVal)),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -392,9 +392,9 @@
         String uuid = internalValue.toString();
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, uuid),
-                true, // store
-                true,
-                false));
+                Field.Store.YES, // store
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -416,9 +416,9 @@
         }
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, pathString),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -435,23 +435,23 @@
         // simple String
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, stringValue),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
         // also create fulltext index of this value
         doc.add(new Field(FieldNames.FULLTEXT,
                 stringValue,
-                false,
-                true,
-                true));
+                Field.Store.NO,
+                Field.Index.TOKENIZED,
+                Field.TermVector.NO));
         // create fulltext index on property
         int idx = fieldName.indexOf(':');
         fieldName = fieldName.substring(0, idx + 1)
                 + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1);
         doc.add(new Field(fieldName, stringValue,
-                false,
-                true,
-                true));
+                Field.Store.NO,
+                Field.Index.TOKENIZED,
+                Field.TermVector.NO));
     }
 
     /**
@@ -475,8 +475,8 @@
         }
         doc.add(new Field(FieldNames.PROPERTIES,
                 FieldNames.createNamedValue(fieldName, normValue),
-                false,
-                true,
-                false));
+                Field.Store.NO,
+                Field.Index.UN_TOKENIZED,
+                Field.TermVector.NO));
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
Tue Dec 12 11:12:28 2006
@@ -23,8 +23,8 @@
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.InputStream;
-import org.apache.lucene.store.OutputStream;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
 
 import java.io.IOException;
 import java.io.File;
@@ -166,9 +166,9 @@
         Directory dest = getDirectory();
         String[] files = dir.list();
         for (int i = 0; i < files.length; i++) {
-            InputStream in = dir.openFile(files[i]);
+            IndexInput in = dir.openInput(files[i]);
             try {
-                OutputStream out = dest.createFile(files[i]);
+                IndexOutput out = dest.createOutput(files[i]);
                 try {
                     long remaining = in.length();
                     while (remaining > 0) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeScan.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeScan.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeScan.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeScan.java
Tue Dec 12 11:12:28 2006
@@ -50,7 +50,7 @@
         return compare <= 0;
     }
 
-    protected float difference() {
+    public float difference() {
         return 1.0f;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
Tue Dec 12 11:12:28 2006
@@ -108,7 +108,7 @@
             num = 1;
         } else {
             // remove document from index
-            num = super.getIndexReader().delete(idTerm);
+            num = super.getIndexReader().deleteDocuments(idTerm);
         }
         numDocs -= num;
         return num;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardTermEnum.java
Tue Dec 12 11:12:28 2006
@@ -135,7 +135,7 @@
     /**
      * @inheritDoc
      */
-    protected float difference() {
+    public float difference() {
         return 1.0f;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/javacc/fulltext/QueryParser.jjt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/javacc/fulltext/QueryParser.jjt?view=diff&rev=486281&r1=486280&r2=486281
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/javacc/fulltext/QueryParser.jjt (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/javacc/fulltext/QueryParser.jjt Tue Dec 12 11:12:28
2006
@@ -233,8 +233,8 @@
     // unless it's already prohibited
     if (clauses.size() > 0 && conj == CONJ_AND) {
       BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1);
-      if (!c.prohibited)
-        c.required = true;
+      if (!c.isProhibited())
+        c.setOccur(BooleanClause.Occur.MUST);
     }
 
     if (clauses.size() > 0 && operator == DEFAULT_OPERATOR_AND && conj
== CONJ_OR) {
@@ -243,8 +243,8 @@
       // notice if the input is a OR b, first term is parsed as required; without
       // this modification a OR b would parsed as +a OR b
       BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1);
-      if (!c.prohibited)
-        c.required = false;
+      if (!c.isProhibited())
+        c.setOccur(BooleanClause.Occur.SHOULD);
     }
 
     // We might have been passed a null query; the term might have been
@@ -266,7 +266,15 @@
       prohibited = (mods == MOD_NOT);
       required   = (!prohibited && conj != CONJ_OR);
     }
-    clauses.addElement(new BooleanClause(q, required, prohibited));
+    BooleanClause.Occur occur = null;
+    if (required) {
+    	occur = BooleanClause.Occur.MUST;
+    } else if (prohibited) {
+    	occur = BooleanClause.Occur.MUST_NOT;
+    } else {
+    	occur = BooleanClause.Occur.SHOULD;
+    }
+    clauses.addElement(new BooleanClause(q, occur));
   }
   
   /**



Mime
View raw message