jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1064058 [1/3] - in /jackrabbit/trunk: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/...
Date Thu, 27 Jan 2011 09:33:15 GMT
Author: mduerig
Date: Thu Jan 27 09:33:13 2011
New Revision: 1064058

URL: http://svn.apache.org/viewvc?rev=1064058&view=rev
Log:
JCR-2415: Update Lucene to 3.0
- Merge all from JCR-2415-lucene-3.0 at 1064038 (reintegration)

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldComparatorBase.java
      - copied unchanged from r1064038, jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldComparatorBase.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldComparatorDecorator.java
      - copied unchanged from r1064038, jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldComparatorDecorator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldComparatorSource.java
      - copied unchanged from r1064038, jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldComparatorSource.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AbstractHitCollector.java
      - copied unchanged from r1064038, jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AbstractHitCollector.java
Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractScoreDocComparator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldSortComparator.java
Modified:
    jackrabbit/trunk/   (props changed)
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
    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/AbstractWeight.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.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/ChildAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LengthSortComparator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LowerCaseSortComparator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.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/NodeTraversingQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NotQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/OffsetCharSequence.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Ordering.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.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/PredicateDerefQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ReadOnlyIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RefCountingIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimilarityQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SingletonTokenStream.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SortedLuceneQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SortedMultiColumnQueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/TermDocsCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/UpperCaseSortComparator.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/WeightedHighlighter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardNameQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/directory/FSDirectoryManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/SameNodeJoinMerger.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ScoreNodeMap.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ChainedTermEnumTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexMigrationTest.java
    jackrabbit/trunk/jackrabbit-parent/pom.xml

Propchange: jackrabbit/trunk/
------------------------------------------------------------------------------
    svn:mergeinfo = /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java Thu Jan 27 09:33:13 2011
@@ -123,7 +123,7 @@ public class PropertyTypeRegistry implem
         // remove all TypeMapping instances refering to this ntName
         synchronized (typeMapping) {
             Map<Name, TypeMapping[]> modified = new HashMap<Name, TypeMapping[]>();
-            for (Iterator it = typeMapping.keySet().iterator(); it.hasNext();) {
+            for (Iterator<Name> it = typeMapping.keySet().iterator(); it.hasNext();) {
                 Name propName = (Name) it.next();
                 TypeMapping[] mapping = typeMapping.get(propName);
                 List<TypeMapping> remove = null;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java Thu Jan 27 09:33:13 2011
@@ -28,7 +28,8 @@ import org.apache.lucene.index.TermVecto
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.analysis.tokenattributes.TermAttribute;
 import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
@@ -231,10 +232,11 @@ public abstract class AbstractExcerpt im
             new TreeMap<String, TermVectorOffsetInfo[]>();
         Reader r = new StringReader(text);
         TokenStream ts = index.getTextAnalyzer().tokenStream("", r);
-        Token t = new Token();
         try {
-            while ((t = ts.next(t)) != null) {
-                String termText = t.term();
+            while (ts.incrementToken()) {
+                OffsetAttribute offset = ts.getAttribute(OffsetAttribute.class);
+                TermAttribute term = ts.getAttribute(TermAttribute.class);
+                String termText = term.term();
                 TermVectorOffsetInfo[] info = termMap.get(termText);
                 if (info == null) {
                     info = new TermVectorOffsetInfo[1];
@@ -244,9 +246,11 @@ public abstract class AbstractExcerpt im
                     System.arraycopy(tmp, 0, info, 0, tmp.length);
                 }
                 info[info.length - 1] = new TermVectorOffsetInfo(
-                        t.startOffset(), t.endOffset());
+                    offset.startOffset(), offset.endOffset());
                 termMap.put(termText, info);
             }
+            ts.end();
+            ts.close();
         } catch (IOException e) {
             // should never happen, we are reading from a string
         }

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?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- 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 Thu Jan 27 09:33:13 2011
@@ -16,16 +16,6 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -40,6 +30,16 @@ import org.apache.tika.io.IOExceptionWit
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Implements common functionality for a lucene index.
  * <p/>
@@ -248,13 +248,7 @@ abstract class AbstractIndex {
         }
         if (indexReader == null) {
             IndexDeletionPolicy idp = getIndexDeletionPolicy();
-            IndexReader reader;
-            if (idp != null) {
-                reader = IndexReader.open(getDirectory(), idp);
-            } else {
-                reader = IndexReader.open(getDirectory());
-            }
-            reader.setTermInfosIndexDivisor(termInfosIndexDivisor);
+            IndexReader reader = IndexReader.open(getDirectory(), idp, false, termInfosIndexDivisor);
             indexReader = new CommittableIndexReader(reader);
         }
         return indexReader;
@@ -318,8 +312,7 @@ abstract class AbstractIndex {
         }
         if (sharedReader == null) {
             // create new shared reader
-            IndexReader reader = IndexReader.open(getDirectory(), true);
-            reader.setTermInfosIndexDivisor(termInfosIndexDivisor);
+            IndexReader reader = IndexReader.open(getDirectory(), null, true, termInfosIndexDivisor);
             CachingIndexReader cr = new CachingIndexReader(
                     reader, cache, initCache);
             sharedReader = new SharedIndexReader(cr);
@@ -496,10 +489,10 @@ abstract class AbstractIndex {
             // mark the document that reindexing is required
             copy.add(new Field(FieldNames.REINDEXING_REQUIRED, "",
                     Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
-            for (Fieldable f : (List<Fieldable>) doc.getFields()) {
+            for (Fieldable f : doc.getFields()) {
                 Fieldable field = null;
                 Field.TermVector tv = getTermVectorParameter(f);
-                Field.Store stored = getStoreParameter(f);
+                Field.Store stored = f.isStored() ? Field.Store.YES : Field.Store.NO;
                 Field.Index indexed = getIndexParameter(f);
                 if (f instanceof LazyTextExtractorField || f.readerValue() != null) {
                     // replace all readers with empty string reader
@@ -508,7 +501,7 @@ abstract class AbstractIndex {
                     field = new Field(f.name(), f.stringValue(),
                             stored, indexed, tv);
                 } else if (f.isBinary()) {
-                    field = new Field(f.name(), f.binaryValue(), stored);
+                    field = new Field(f.name(), f.getBinaryValue(), stored);
                 }
                 if (field != null) {
                     field.setOmitNorms(f.getOmitNorms());
@@ -585,22 +578,6 @@ abstract class AbstractIndex {
     }
 
     /**
-     * Returns the store parameter set on <code>f</code>.
-     *
-     * @param f a lucene field.
-     * @return the store parameter on <code>f</code>.
-     */
-    private Field.Store getStoreParameter(Fieldable f) {
-        if (f.isCompressed()) {
-            return Field.Store.COMPRESS;
-        } else if (f.isStored()) {
-            return Field.Store.YES;
-        } else {
-            return Field.Store.NO;
-        }
-    }
-
-    /**
      * Returns the term vector parameter set on <code>f</code>.
      *
      * @param f a lucene field.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java Thu Jan 27 09:33:13 2011
@@ -27,7 +27,8 @@ import java.io.IOException;
  * <code>AbstractWeight</code> implements base functionality for custom lucene
  * weights in jackrabbit.
  */
-abstract class AbstractWeight implements Weight {
+@SuppressWarnings("serial")
+abstract class AbstractWeight extends Weight {
 
     /**
      * The searcher for this weight.
@@ -52,8 +53,8 @@ abstract class AbstractWeight implements
      * @return the scorer instance
      * @throws IOException if an error occurs while reading from the index
      */
-    protected abstract Scorer createScorer(IndexReader reader)
-            throws IOException;
+    protected abstract Scorer createScorer(IndexReader reader, boolean scoreDocsInOrder,
+            boolean topScorer) throws IOException;
 
     /**
      * {@inheritDoc}
@@ -61,7 +62,8 @@ abstract class AbstractWeight implements
      * Returns a {@link MultiScorer} if the passed <code>reader</code> is of
      * type {@link MultiIndexReader}.
      */
-    public Scorer scorer(IndexReader reader) throws IOException {
+    public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
+            boolean topScorer) throws IOException {
         if (reader instanceof MultiIndexReader) {
             MultiIndexReader mir = (MultiIndexReader) reader;
             IndexReader[] readers = mir.getIndexReaders();
@@ -75,12 +77,12 @@ abstract class AbstractWeight implements
             starts[readers.length] = maxDoc;
             Scorer[] scorers = new Scorer[readers.length];
             for (int i = 0; i < readers.length; i++) {
-                scorers[i] = scorer(readers[i]);
+                scorers[i] = scorer(readers[i], scoreDocsInOrder, topScorer);
             }
 
             return new MultiScorer(searcher.getSimilarity(), scorers, starts);
         } else {
-            return createScorer(reader);
+            return createScorer(reader, scoreDocsInOrder, topScorer);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java Thu Jan 27 09:33:13 2011
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.index.FilterIndexReader;
 import org.apache.lucene.index.IndexReader;
@@ -287,7 +286,7 @@ class CachingIndexReader extends FilterI
      * @throws IOException if an error occurs while reading from the index.
      */
     public TermDocs termDocs(Term term) throws IOException {
-        if (term.field() == FieldNames.UUID) {
+        if (term != null && term.field() == FieldNames.UUID) {
             // check cache if we have one
             if (cache != null) {
                 DocNumberCache.Entry e = cache.get(term.text());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java Thu Jan 27 09:33:13 2011
@@ -110,7 +110,7 @@ public final class CachingMultiIndexRead
      * {@inheritDoc}
      */
     public TermDocs termDocs(Term term) throws IOException {
-        if (term.field() == FieldNames.UUID) {
+        if (term != null && term.field() == FieldNames.UUID) {
             // check cache
             DocNumberCache.Entry e = cache.get(term.text());
             if (e != null) {

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?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- 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 Thu Jan 27 09:33:13 2011
@@ -21,6 +21,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.TermEnum;
 import org.apache.lucene.search.MultiTermQuery;
 import org.apache.lucene.search.FilteredTermEnum;
+import org.apache.lucene.util.ToStringUtils;
 
 import java.io.IOException;
 import java.util.List;
@@ -33,6 +34,7 @@ import java.util.Map;
  * <code>CaseTermQuery</code> implements a term query which convert the term
  * from the index either to upper or lower case before it is matched.
  */
+@SuppressWarnings("serial")
 abstract class CaseTermQuery extends MultiTermQuery implements TransformConstants {
 
     /**
@@ -40,19 +42,34 @@ abstract class CaseTermQuery extends Mul
      * upper-cased.
      */
     protected final int transform;
+    private final Term term;
 
     CaseTermQuery(Term term, int transform) {
-        super(term);
+        this.term = term;
         this.transform = transform;
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     protected FilteredTermEnum getEnum(IndexReader reader) throws IOException {
         return new CaseTermEnum(reader);
     }
 
+    /** Prints a user-readable version of this query. */
+    @Override
+    public String toString(String field) {
+        StringBuffer buffer = new StringBuffer();
+        if (!term.field().equals(field)) {
+            buffer.append(term.field());
+            buffer.append(':');
+        }
+        buffer.append(term.text());
+        buffer.append(ToStringUtils.boost(getBoost()));
+        return buffer.toString();
+    }
+
     static final class Upper extends CaseTermQuery {
 
         Upper(Term term) {
@@ -65,7 +82,6 @@ abstract class CaseTermQuery extends Mul
         Lower(Term term) {
             super(term, TRANSFORM_LOWER_CASE);
         }
-
     }
 
     private final class CaseTermEnum extends FilteredTermEnum {
@@ -76,9 +92,7 @@ abstract class CaseTermQuery extends Mul
             final Map<Term, Integer> orderedTerms =
                 new LinkedHashMap<Term, Integer>();
 
-            Term term = getTerm();
-
-            // there are always two range scanse: one with an initial
+            // there are always two range scans: one with an initial
             // lower case character and another one with an initial upper case
             // character
             List<RangeScan> rangeScans = new ArrayList<RangeScan>(2);
@@ -158,20 +172,24 @@ abstract class CaseTermQuery extends Mul
                     getNext();
                 }
 
+                @Override
                 public boolean next() {
                     getNext();
                     return current != null;
                 }
 
+                @Override
                 public Term term() {
                     return current;
                 }
 
+                @Override
                 public int docFreq() {
                     Integer docFreq = orderedTerms.get(current);
                     return docFreq != null ? docFreq : 0;
                 }
 
+                @Override
                 public void close() {
                     // nothing to close
                 }
@@ -182,15 +200,18 @@ abstract class CaseTermQuery extends Mul
             });
         }
 
+        @Override
         protected boolean termCompare(Term term) {
             // they all match
             return true;
         }
 
+        @Override
         public float difference() {
             return 1.0f;
         }
 
+        @Override
         protected boolean endEnum() {
             // todo correct?
             return false;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java Thu Jan 27 09:33:13 2011
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.query
 
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.query.lucene.hits.AbstractHitCollector;
 import org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits;
 import org.apache.jackrabbit.core.query.lucene.hits.Hits;
 import org.apache.jackrabbit.core.query.lucene.hits.ScorerHits;
@@ -32,7 +33,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Searcher;
@@ -54,6 +54,7 @@ import java.util.ArrayList;
  * Implements a lucene <code>Query</code> which returns the child nodes of the
  * nodes selected by another <code>Query</code>.
  */
+@SuppressWarnings("serial")
 class ChildAxisQuery extends Query implements JackrabbitQuery {
 
     /**
@@ -192,7 +193,7 @@ class ChildAxisQuery extends Query imple
      * @param searcher the <code>Searcher</code> instance to use.
      * @return a <code>ChildAxisWeight</code>.
      */
-    protected Weight createWeight(Searcher searcher) {
+    public Weight createWeight(Searcher searcher) {
         return new ChildAxisWeight(searcher);
     }
 
@@ -273,7 +274,7 @@ class ChildAxisQuery extends Query imple
     /**
      * The <code>Weight</code> implementation for this <code>ChildAxisQuery</code>.
      */
-    private class ChildAxisWeight implements Weight {
+    private class ChildAxisWeight extends Weight {
 
         /**
          * The searcher in use
@@ -326,10 +327,11 @@ class ChildAxisQuery extends Query imple
          * @return a <code>ChildAxisScorer</code>.
          * @throws IOException if an error occurs while reading from the index.
          */
-        public Scorer scorer(IndexReader reader) throws IOException {
-            contextScorer = contextQuery.weight(searcher).scorer(reader);
+        @Override
+        public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException {
+            contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
             if (nameTest != null) {
-                nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader);
+                nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
             }
             return new ChildAxisScorer(searcher.getSimilarity(),
                     reader, (HierarchyResolver) reader);
@@ -385,52 +387,48 @@ class ChildAxisQuery extends Query imple
             this.hResolver = hResolver;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean next() throws IOException {
+        @Override
+        public int nextDoc() throws IOException {
+            if (nextDoc == NO_MORE_DOCS) {
+                return nextDoc;
+            }
+
             calculateChildren();
             do {
                 nextDoc = hits.next();
             } while (nextDoc > -1 && !indexIsValid(nextDoc));
 
-            return nextDoc > -1;
+            if (nextDoc < 0) {
+                nextDoc = NO_MORE_DOCS;
+            }
+            return nextDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public int doc() {
+        @Override
+        public int docID() {
             return nextDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
+        @Override
         public float score() throws IOException {
             return 1.0f;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean skipTo(int target) throws IOException {
+        @Override
+        public int advance(int target) throws IOException {
+            if (nextDoc == NO_MORE_DOCS) {
+                return nextDoc;
+            }
+
             calculateChildren();
             nextDoc = hits.skipTo(target);
             while (nextDoc > -1 && !indexIsValid(nextDoc)) {
-                next();
+                nextDoc();
             }
-            return nextDoc > -1;
-        }
-
-        /**
-         * {@inheritDoc}
-         *
-         * @throws UnsupportedOperationException this implementation always
-         *                                       throws an <code>UnsupportedOperationException</code>.
-         */
-        public Explanation explain(int doc) throws IOException {
-            throw new UnsupportedOperationException();
+            if (nextDoc < 0) {
+                nextDoc = NO_MORE_DOCS;
+            }
+            return nextDoc;
         }
 
         private void calculateChildren() throws IOException {
@@ -440,19 +438,21 @@ class ChildAxisQuery extends Query imple
                 if (nameTestScorer == null) {
                     // always use simple in that case
                     calc[0] = new SimpleChildrenCalculator(reader, hResolver);
-                    contextScorer.score(new HitCollector() {
-                        public void collect(int doc, float score) {
+                    contextScorer.score(new AbstractHitCollector() {
+                        @Override
+                        protected void collect(int doc, float score) {
                             calc[0].collectContextHit(doc);
                         }
                     });
                 } else {
                     // start simple but switch once threshold is reached
                     calc[0] = new SimpleChildrenCalculator(reader, hResolver);
-                    contextScorer.score(new HitCollector() {
+                    contextScorer.score(new AbstractHitCollector() {
 
                         private List<Integer> docIds = new ArrayList<Integer>();
 
-                        public void collect(int doc, float score) {
+                        @Override
+                        protected void collect(int doc, float score) {
                             calc[0].collectContextHit(doc);
                             if (docIds != null) {
                                 docIds.add(doc);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java Thu Jan 27 09:33:13 2011
@@ -300,8 +300,8 @@ public class DefaultHighlighter {
                     new String(cbuf, skippedChars, cbuf.length - skippedChars)));
 
             // iterate terms
-            for (Iterator iter = fi.iterator(); iter.hasNext();) {
-                TermVectorOffsetInfo ti = (TermVectorOffsetInfo) iter.next();
+            for (Iterator<TermVectorOffsetInfo> iter = fi.iterator(); iter.hasNext();) {
+                TermVectorOffsetInfo ti = iter.next();
                 nextStart = ti.getStartOffset();
                 if (nextStart - pos > 0) {
                     cbuf = new char[nextStart - pos];
@@ -420,11 +420,10 @@ public class DefaultHighlighter {
             }
             offsetInfosList.add(offsetinfo);
             numTerms++;
-            endOffset = offsetinfo.getEndOffset();
             return true;
         }
 
-        public Iterator iterator() {
+        public Iterator<TermVectorOffsetInfo> iterator() {
             return offsetInfosList.iterator();
         }
 
@@ -432,10 +431,6 @@ public class DefaultHighlighter {
             return startOffset;
         }
 
-        public int getEndOffset() {
-            return endOffset;
-        }
-
         public int numTerms() {
             return numTerms;
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java Thu Jan 27 09:33:13 2011
@@ -34,7 +34,7 @@ public class DefaultQueryHits extends Ab
     /**
      * An iterator over the query nodes.
      */
-    private final Iterator scoreNodes;
+    private final Iterator<ScoreNode> scoreNodes;
 
     /**
      * Creates a new <code>DefaultQueryHits</code> instance based on the passed
@@ -42,7 +42,7 @@ public class DefaultQueryHits extends Ab
      *
      * @param scoreNodes a collection of {@link ScoreNode}s.
      */
-    public DefaultQueryHits(Collection scoreNodes) {
+    public DefaultQueryHits(Collection<ScoreNode> scoreNodes) {
         this.size = scoreNodes.size();
         this.scoreNodes = scoreNodes.iterator();
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java Thu Jan 27 09:33:13 2011
@@ -17,15 +17,14 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.search.Weight;
+import org.apache.jackrabbit.core.query.lucene.hits.AbstractHitCollector;
 import org.apache.jackrabbit.spi.Name;
 
 import java.io.IOException;
@@ -38,6 +37,7 @@ import java.util.Set;
  * Implements a lucene <code>Query</code> which returns the nodes selected by
  * a reference property of the context node.
  */
+@SuppressWarnings("serial")
 class DerefQuery extends Query {
 
     /**
@@ -102,7 +102,7 @@ class DerefQuery extends Query {
      * @param searcher the <code>Searcher</code> instance to use.
      * @return a <code>DerefWeight</code>.
      */
-    protected Weight createWeight(Searcher searcher) {
+    public Weight createWeight(Searcher searcher) {
         return new DerefWeight(searcher);
     }
 
@@ -148,7 +148,7 @@ class DerefQuery extends Query {
     /**
      * The <code>Weight</code> implementation for this <code>DerefQuery</code>.
      */
-    private class DerefWeight implements Weight {
+    private class DerefWeight extends Weight {
 
         /**
          * The searcher in use
@@ -201,10 +201,12 @@ class DerefQuery extends Query {
          * @return a <code>DerefScorer</code>.
          * @throws IOException if an error occurs while reading from the index.
          */
-        public Scorer scorer(IndexReader reader) throws IOException {
-            contextScorer = contextQuery.weight(searcher).scorer(reader);
+        @Override
+        public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
+                boolean topScorer) throws IOException {
+            contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
             if (nameTest != null) {
-                nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader);
+                nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
             }
             return new DerefScorer(searcher.getSimilarity(), reader);
         }
@@ -256,46 +258,42 @@ class DerefQuery extends Query {
             this.hits = new BitSet(reader.maxDoc());
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean next() throws IOException {
+        @Override
+        public int nextDoc() throws IOException {
+            if (nextDoc == NO_MORE_DOCS) {
+                return nextDoc;
+            }
+
             calculateChildren();
             nextDoc = hits.nextSetBit(nextDoc + 1);
-            return nextDoc > -1;
+            if (nextDoc < 0) {
+                nextDoc = NO_MORE_DOCS;
+            }
+            return nextDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public int doc() {
+        @Override
+        public int docID() {
             return nextDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
+        @Override
         public float score() throws IOException {
             return 1.0f;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean skipTo(int target) throws IOException {
+        @Override
+        public int advance(int target) throws IOException {
+            if (nextDoc == NO_MORE_DOCS) {
+                return nextDoc;
+            }
+
             calculateChildren();
             nextDoc = hits.nextSetBit(target);
-            return nextDoc > -1;
-        }
-
-        /**
-         * {@inheritDoc}
-         *
-         * @throws UnsupportedOperationException this implementation always
-         *                                       throws an <code>UnsupportedOperationException</code>.
-         */
-        public Explanation explain(int doc) throws IOException {
-            throw new UnsupportedOperationException();
+            if (nextDoc < 0) {
+                nextDoc = NO_MORE_DOCS;
+            }
+            return nextDoc;
         }
 
         /**
@@ -311,8 +309,9 @@ class DerefQuery extends Query {
         private void calculateChildren() throws IOException {
             if (uuids == null) {
                 uuids = new ArrayList<String>();
-                contextScorer.score(new HitCollector() {
-                    public void collect(int doc, float score) {
+                contextScorer.score(new AbstractHitCollector() {
+                    @Override
+                    protected void collect(int doc, float score) {
                         hits.set(doc);
                     }
                 });
@@ -320,8 +319,9 @@ class DerefQuery extends Query {
                 // collect nameTest hits
                 final BitSet nameTestHits = new BitSet();
                 if (nameTestScorer != null) {
-                    nameTestScorer.score(new HitCollector() {
-                        public void collect(int doc, float score) {
+                    nameTestScorer.score(new AbstractHitCollector() {
+                        @Override
+                        protected void collect(int doc, float score) {
                             nameTestHits.set(doc);
                         }
                     });

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Thu Jan 27 09:33:13 2011
@@ -16,16 +16,16 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.query.lucene.hits.AbstractHitCollector;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Similarity;
-import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Sort;
-import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.lucene.search.Weight;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,16 +33,17 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import java.io.IOException;
 import java.util.BitSet;
-import java.util.Set;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
-import java.util.Iterator;
 
 /**
  * Implements a lucene <code>Query</code> which filters a sub query by checking
  * whether the nodes selected by that sub query are descendants or self of
  * nodes selected by a context query.
  */
+@SuppressWarnings("serial")
 class DescendantSelfAxisQuery extends Query implements JackrabbitQuery {
 
     /**
@@ -171,7 +172,7 @@ class DescendantSelfAxisQuery extends Qu
      * @param searcher the <code>Searcher</code> instance to use.
      * @return a <code>DescendantSelfAxisWeight</code>.
      */
-    protected Weight createWeight(Searcher searcher) {
+    public Weight createWeight(Searcher searcher) {
         return new DescendantSelfAxisWeight(searcher);
     }
 
@@ -321,7 +322,7 @@ class DescendantSelfAxisQuery extends Qu
      * The <code>Weight</code> implementation for this
      * <code>DescendantSelfAxisWeight</code>.
      */
-    private class DescendantSelfAxisWeight implements Weight {
+    private class DescendantSelfAxisWeight extends Weight {
 
         /**
          * The searcher in use
@@ -376,9 +377,10 @@ class DescendantSelfAxisQuery extends Qu
          * @return a <code>DescendantSelfAxisScorer</code>.
          * @throws IOException if an error occurs while reading from the index.
          */
-        public Scorer scorer(IndexReader reader) throws IOException {
-            contextScorer = contextQuery.weight(searcher).scorer(reader);
-            subScorer = subQuery.weight(searcher).scorer(reader);
+        public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
+                boolean topScorer) throws IOException {
+            contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
+            subScorer = subQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
             HierarchyResolver resolver = (HierarchyResolver) reader;
             return new DescendantSelfAxisScorer(searcher.getSimilarity(), reader, resolver);
         }
@@ -429,6 +431,11 @@ class DescendantSelfAxisQuery extends Qu
         private final int[] singleDoc = new int[1];
 
         /**
+         * The next document id to be returned
+         */
+        private int currentDoc = -1;
+
+        /**
          * Creates a new <code>DescendantSelfAxisScorer</code>.
          *
          * @param similarity the <code>Similarity</code> instance to use.
@@ -444,59 +451,59 @@ class DescendantSelfAxisQuery extends Qu
             this.contextHits = new BitSet(reader.maxDoc());
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean next() throws IOException {
-            collectContextHits();
-            if (!subScorer.next() || contextHits.isEmpty()) {
-                return false;
+        @Override
+        public int nextDoc() throws IOException {
+            if (currentDoc == NO_MORE_DOCS) {
+                return currentDoc;
             }
-            int nextDoc = subScorer.doc();
-            while (nextDoc > -1) {
 
-                if (isValid(nextDoc)) {
-                    return true;
+            collectContextHits();
+            currentDoc = subScorer.nextDoc();
+            if (contextHits.isEmpty()) {
+                currentDoc = NO_MORE_DOCS;
+            }
+            while (currentDoc != NO_MORE_DOCS) {
+                if (isValid(currentDoc)) {
+                    return currentDoc;
                 }
 
                 // try next
-                nextDoc = subScorer.next() ? subScorer.doc() : -1;
+                currentDoc = subScorer.nextDoc();
             }
-            return false;
+            return currentDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public int doc() {
-            return subScorer.doc();
+        @Override
+        public int docID() {
+            return currentDoc;
         }
 
-        /**
-         * {@inheritDoc}
-         */
+        @Override
         public float score() throws IOException {
             return subScorer.score();
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        public boolean skipTo(int target) throws IOException {
-            boolean match = subScorer.skipTo(target);
-            if (match) {
-                collectContextHits();
-                return isValid(subScorer.doc()) || next();
+        @Override
+        public int advance(int target) throws IOException {
+            if (currentDoc == NO_MORE_DOCS) {
+                return currentDoc;
+            }
+
+            currentDoc = subScorer.nextDoc();
+            if (currentDoc == NO_MORE_DOCS) {
+                return NO_MORE_DOCS;
             } else {
-                return false;
+                collectContextHits();
+                return isValid(currentDoc) ? currentDoc : nextDoc();
             }
         }
 
         private void collectContextHits() throws IOException {
             if (!contextHitsCalculated) {
                 long time = System.currentTimeMillis();
-                contextScorer.score(new HitCollector() {
-                    public void collect(int doc, float score) {
+                contextScorer.score(new AbstractHitCollector() {
+                    @Override
+                    protected void collect(int doc, float score) {
                         contextHits.set(doc);
                     }
                 }); // find all
@@ -514,14 +521,6 @@ class DescendantSelfAxisQuery extends Qu
         }
 
         /**
-         * @throws UnsupportedOperationException this implementation always
-         *                                       throws an <code>UnsupportedOperationException</code>.
-         */
-        public Explanation explain(int doc) throws IOException {
-            throw new UnsupportedOperationException();
-        }
-
-        /**
          * Returns <code>true</code> if <code>doc</code> is a valid match from
          * the sub scorer against the context hits. The caller must ensure
          * that the context hits are calculated before this method is called!

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java Thu Jan 27 09:33:13 2011
@@ -270,6 +270,7 @@ class DocOrderScoreNodeIterator implemen
     /**
      * Indicates that sorting failed.
      */
+    @SuppressWarnings("serial")
     private static final class SortFailedException extends RuntimeException {
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java Thu Jan 27 09:33:13 2011
@@ -30,6 +30,7 @@ public class FieldSelectors {
     private FieldSelectors() {
     }
 
+    @SuppressWarnings("serial")
     public static final FieldSelector UUID = new FieldSelector() {
         /**
          * Only accepts {@link FieldNames#UUID}.
@@ -46,6 +47,7 @@ public class FieldSelectors {
         }
     };
 
+    @SuppressWarnings("serial")
     public static final FieldSelector UUID_AND_PARENT = new FieldSelector() {
         /**
          * Accepts {@link FieldNames#UUID} and {@link FieldNames#PARENT}.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java Thu Jan 27 09:33:13 2011
@@ -37,7 +37,7 @@ public class IDField extends AbstractFie
         this.isStored = true;
         this.isTokenized = false;
         this.omitNorms = true;
-        this.omitTf = true;
+        this.omitTermFreqAndPositions = true;
     }
 
     public String stringValue() {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java Thu Jan 27 09:33:13 2011
@@ -79,7 +79,7 @@ public class IndexDeletionPolicyImpl imp
 
     void readCurrentGeneration() throws IOException {
         Directory dir = index.getDirectory();
-        String[] names = dir.list();
+        String[] names = dir.listAll();
         long max = 0;
         if (names != null) {
             for (String name : names) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java Thu Jan 27 09:33:13 2011
@@ -102,7 +102,8 @@ public class IndexFormatVersion {
      * index reader.
      */
     public static IndexFormatVersion getVersion(IndexReader indexReader) {
-        Collection fields = indexReader.getFieldNames(
+        @SuppressWarnings("unchecked")
+        Collection<String> fields = indexReader.getFieldNames(
                 IndexReader.FieldOption.ALL);
         if (fields.contains(FieldNames.LOCAL_NAME) || indexReader.numDocs() == 0) {
             return IndexFormatVersion.V3;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java Thu Jan 27 09:33:13 2011
@@ -72,7 +72,7 @@ class IndexHistory {
         this.indexDir = dir;
         this.maxAge = maxAge;
         // read all index infos
-        String[] names = dir.list();
+        String[] names = dir.listAll();
         if (names != null) {
             for (String name : names) {
                 if (name.startsWith(INDEXES)) {
@@ -131,10 +131,10 @@ class IndexHistory {
     void pruneOutdated() {
         long threshold = System.currentTimeMillis() - maxAge;
         log.debug("Pruning index infos older than: " + threshold + "(" + indexDir + ")");
-        Iterator it = indexInfosMap.values().iterator();
+        Iterator<IndexInfos> it = indexInfosMap.values().iterator();
         // never prune the current generation
         if (it.hasNext()) {
-            IndexInfos infos = (IndexInfos) it.next();
+            IndexInfos infos = it.next();
             log.debug("Skipping first index infos. generation=" + infos.getGeneration());
         }
         while (it.hasNext()) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java Thu Jan 27 09:33:13 2011
@@ -157,8 +157,8 @@ class IndexInfos implements Cloneable {
                 dataOut.writeInt(WITH_GENERATION);
                 dataOut.writeInt(counter);
                 dataOut.writeInt(indexes.size());
-                for (Iterator it = iterator(); it.hasNext(); ) {
-                    IndexInfo info = (IndexInfo) it.next();
+                for (Iterator<IndexInfo> it = iterator(); it.hasNext(); ) {
+                    IndexInfo info = it.next();
                     dataOut.writeUTF(info.getName());
                     dataOut.writeLong(info.getGeneration());
                     log.debug("  + {}:{}", info.getName(), info.getGeneration());
@@ -185,7 +185,7 @@ class IndexInfos implements Cloneable {
      * @return an iterator over the {@link IndexInfo}s contained in this index
      *          infos.
      */
-    Iterator iterator() {
+    Iterator<IndexInfo> iterator() {
         return indexes.values().iterator();
     }
 
@@ -267,10 +267,11 @@ class IndexInfos implements Cloneable {
      *
      * @return a clone of this index infos.
      */
+    @SuppressWarnings("unchecked")
     public IndexInfos clone() {
         try {
             IndexInfos clone = (IndexInfos) super.clone();
-            clone.indexes = (LinkedHashMap) indexes.clone();
+            clone.indexes = (LinkedHashMap<String, IndexInfo>) indexes.clone();
             for (Map.Entry<String, IndexInfo> entry : clone.indexes.entrySet()) {
                 entry.setValue(entry.getValue().clone());
             }
@@ -342,12 +343,15 @@ class IndexInfos implements Cloneable {
      * @return names of all generation files of this index infos.
      */
     private static String[] getFileNames(Directory directory, final String base) {
-        String[] names = new String[0];
+        String[] names = null;
         try {
-            names = directory.list();
+            names = directory.listAll();
         } catch (IOException e) {
             // TODO: log warning? or throw?
         }
+        if (names == null) {
+            return new String[0];
+        }
         List<String> nameList = new ArrayList<String>(names.length);
         for (String n : names) {
             if (n.startsWith(base)) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java Thu Jan 27 09:33:13 2011
@@ -329,7 +329,7 @@ class IndexMerger implements IndexListen
      * many document it contains. <code>Index</code> is comparable using the
      * number of documents it contains.
      */
-    private static final class Index implements Comparable {
+    private static final class Index implements Comparable<Index> {
 
         /**
          * The name of the index.
@@ -361,8 +361,7 @@ class IndexMerger implements IndexListen
          *         Index is less than, equal to, or greater than the specified
          *         Index.
          */
-        public int compareTo(Object o) {
-            Index other = (Index) o;
+        public int compareTo(Index other) {
             int val = numDocs < other.numDocs ? -1 : (numDocs == other.numDocs ? 0 : 1);
             if (val != 0) {
                 return val;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java Thu Jan 27 09:33:13 2011
@@ -113,7 +113,7 @@ public class IndexMigration {
                     IndexWriter.MaxFieldLength.UNLIMITED);
             try {
                 IndexReader r = new MigrationIndexReader(
-                        IndexReader.open(index.getDirectory()),
+                        IndexReader.open(index.getDirectory(), true),
                         oldSeparatorChar);
                 try {
                     writer.addIndexes(new IndexReader[]{r});

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java Thu Jan 27 09:33:13 2011
@@ -151,7 +151,8 @@ public class IndexingConfigurationImpl
                     if (analyzerNode.getNodeName().equals("analyzer")) {
                         String analyzerClassName = analyzerNode.getAttributes().getNamedItem("class").getNodeValue();
                         try {
-                        Class clazz = Class.forName(analyzerClassName);
+                            @SuppressWarnings("rawtypes")
+                            Class clazz = Class.forName(analyzerClassName);
                             if (clazz == JackrabbitAnalyzer.class) {
                                 log.warn("Not allowed to configure " + JackrabbitAnalyzer.class.getName() +  " for a property. "
                                         + "Using default analyzer for that property.");

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java Thu Jan 27 09:33:13 2011
@@ -124,9 +124,9 @@ class IndexingQueue {
             finished.addAll(pendingDocuments.values());
         }
 
-        Iterator it = finished.iterator();
+        Iterator<Document> it = finished.iterator();
         while (it.hasNext()) {
-            Document doc = (Document) it.next();
+            Document doc = it.next();
             if (!Util.isDocumentReady(doc)) {
                 it.remove();
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java Thu Jan 27 09:33:13 2011
@@ -18,10 +18,12 @@ package org.apache.jackrabbit.core.query
 
 import java.io.IOException;
 import java.io.Reader;
+import java.util.Collections;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.util.Version;
 
 /**
  * This is the global jackrabbit lucene analyzer. By default, all
@@ -39,7 +41,7 @@ public class JackrabbitAnalyzer  extends
      * The default Jackrabbit analyzer if none is configured in <code><SearchIndex></code>
      * configuration.
      */
-    private Analyzer defaultAnalyzer =  new StandardAnalyzer(new String[]{});
+    private Analyzer defaultAnalyzer =  new StandardAnalyzer(Version.LUCENE_24, Collections.emptySet());
 
     /**
      * The indexing configuration.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java Thu Jan 27 09:33:13 2011
@@ -106,6 +106,11 @@ public final class JackrabbitIndexReader
         return reader.getIndexReaders();
     }
 
+    public IndexReader[] getSequentialSubReaders() {
+      // No sequential sub-readers
+      return null;
+    }
+
     /**
      * {@inheritDoc}
      */

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java Thu Jan 27 09:33:13 2011
@@ -51,6 +51,7 @@ import org.xml.sax.SAXException;
  *
  * @since Apache Jackrabbit 2.0
  */
+@SuppressWarnings("serial")
 class JackrabbitParser implements Parser {
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java Thu Jan 27 09:33:13 2011
@@ -24,6 +24,7 @@ import org.apache.lucene.queryParser.Que
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.util.Version;
 
 /**
  * <code>JackrabbitQueryParser</code> extends the standard lucene query parser
@@ -50,7 +51,7 @@ public class JackrabbitQueryParser exten
                                  Analyzer analyzer,
                                  SynonymProvider synonymProvider,
                                  PerQueryCache cache) {
-        super(fieldName, analyzer);
+        super(Version.LUCENE_24, fieldName, analyzer);
         this.synonymProvider = synonymProvider;
         this.cache = cache;
         setAllowLeadingWildcard(true);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java Thu Jan 27 09:33:13 2011
@@ -39,7 +39,7 @@ public class JackrabbitTermQuery extends
         super(t);
     }
 
-    protected Weight createWeight(Searcher searcher) throws IOException {
+    public Weight createWeight(Searcher searcher) throws IOException {
         return new JackrabbitTermWeight(searcher, super.createWeight(searcher));
     }
 
@@ -63,8 +63,9 @@ public class JackrabbitTermQuery extends
         /**
          * {@inheritDoc}
          */
-        protected Scorer createScorer(IndexReader reader) throws IOException {
-            return weight.scorer(reader);
+        protected Scorer createScorer(IndexReader reader, boolean scoreDocsInOrder,
+                boolean topScorer) throws IOException {
+            return weight.scorer(reader, scoreDocsInOrder, topScorer);
         }
 
         /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java Thu Jan 27 09:33:13 2011
@@ -42,6 +42,7 @@ import org.xml.sax.helpers.DefaultHandle
  *
  * @see #isExtractorFinished()
  */
+@SuppressWarnings("serial")
 public class LazyTextExtractorField extends AbstractField {
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LengthSortComparator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LengthSortComparator.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LengthSortComparator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LengthSortComparator.java Thu Jan 27 09:33:13 2011
@@ -16,23 +16,20 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import java.io.IOException;
-
-import org.apache.lucene.search.SortComparatorSource;
-import org.apache.lucene.search.ScoreDocComparator;
-import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.index.IndexReader;
+import org.apache.jackrabbit.core.query.lucene.SharedFieldComparatorSource.SimpleFieldComparator;
 import org.apache.jackrabbit.spi.NameFactory;
-import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
+import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
+import org.apache.lucene.search.FieldComparator;
+import org.apache.lucene.search.FieldComparatorSource;
+
+import java.io.IOException;
 
 /**
- * <code>LengthSortComparator</code> implements a sort comparator source that
+ * <code>LengthSortComparator</code> implements a <code>FieldComparator</code> which
  * sorts on the length of property values.
  */
-public class LengthSortComparator implements SortComparatorSource {
-
-    private static final long serialVersionUID = 2513564768671391632L;
+public class LengthSortComparator extends FieldComparatorSource {
 
     /**
      * The index internal namespace mappings.
@@ -43,52 +40,15 @@ public class LengthSortComparator implem
         this.nsMappings = nsMappings;
     }
 
-    /**
-     * Creates a new comparator.
-     *
-     * @param reader    the current index reader.
-     * @param fieldname the name of the property to sort on. This is the string
-     *                  representation of {@link org.apache.jackrabbit.spi.Name
-     *                  Name}.
-     * @return the score doc comparator.
-     * @throws IOException if an error occurs while reading from the index.
-     */
-    public ScoreDocComparator newComparator(IndexReader reader,
-                                            String fieldname)
-            throws IOException {
+    @Override
+    public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
         NameFactory factory = NameFactoryImpl.getInstance();
         try {
-            return new Comparator(reader,
-                    nsMappings.translateName(factory.create(fieldname)));
-        } catch (IllegalNameException e) {
+            return new SimpleFieldComparator(nsMappings.translateName(factory.create(fieldname)), FieldNames.PROPERTY_LENGTHS, numHits);
+        }
+        catch (IllegalNameException e) {
             throw Util.createIOException(e);
         }
     }
 
-    private final class Comparator extends AbstractScoreDocComparator {
-
-        /**
-         * The term look ups of the index segments.
-         */
-        protected final SharedFieldCache.ValueIndex[] indexes;
-
-        public Comparator(IndexReader reader,
-                          String propertyName) throws IOException {
-            super(reader);
-            this.indexes = new SharedFieldCache.ValueIndex[readers.size()];
-
-            String namedLength = FieldNames.createNamedValue(propertyName, "");
-            for (int i = 0; i < readers.size(); i++) {
-                IndexReader r = readers.get(i);
-                indexes[i] = SharedFieldCache.INSTANCE.getValueIndex(
-                        r, FieldNames.PROPERTY_LENGTHS,
-                        namedLength, LengthSortComparator.this);
-            }
-        }
-
-        public Comparable sortValue(ScoreDoc i) {
-            int idx = readerIndex(i.doc);
-            return indexes[idx].getValue(i.doc - starts[idx]);
-        }
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java Thu Jan 27 09:33:13 2011
@@ -26,6 +26,7 @@ import java.util.Set;
 /**
  * <code>LocalNameQuery</code> implements a query for the local name of a node.
  */
+@SuppressWarnings("serial")
 public class LocalNameQuery extends Query {
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java Thu Jan 27 09:33:13 2011
@@ -22,6 +22,7 @@ import org.apache.lucene.index.Term;
  * <code>LocalNameRangeQuery</code> implements a range query on the local name
  * of nodes.
  */
+@SuppressWarnings("serial")
 public class LocalNameRangeQuery extends RangeQuery {
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LowerCaseSortComparator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LowerCaseSortComparator.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LowerCaseSortComparator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LowerCaseSortComparator.java Thu Jan 27 09:33:13 2011
@@ -16,71 +16,43 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import java.io.IOException;
+import org.apache.lucene.search.FieldComparator;
+import org.apache.lucene.search.FieldComparatorSource;
 
-import org.apache.lucene.search.ScoreDocComparator;
-import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.SortField;
-import org.apache.lucene.search.SortComparatorSource;
-import org.apache.lucene.index.IndexReader;
+import java.io.IOException;
 
 /**
- * <code>LowerCaseSortComparator</code> implements a sort comparator that
- * compares the lower-cased string values of a base sort comparator.
+ * <code>LowerCaseSortComparator</code> implements a <code>FieldComparator</code> which
+ * compares the lower-cased string values of a base comparator.
  */
-public class LowerCaseSortComparator implements SortComparatorSource {
-
-    private static final long serialVersionUID = 5396206509020979445L;
+public class LowerCaseSortComparator extends FieldComparatorSource {
 
     /**
-     * The base sort comparator.
+     * The base comparator.
      */
-    private final SortComparatorSource base;
+    private final FieldComparatorSource base;
 
     /**
-     * Creates a new lower case sort comparator.
+     * Creates a new upper case sort comparator.
      *
      * @param base the base sort comparator source.
      */
-    public LowerCaseSortComparator(SortComparatorSource base) {
+    public LowerCaseSortComparator(FieldComparatorSource base) {
         this.base = base;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public ScoreDocComparator newComparator(IndexReader reader,
-                                            String fieldname)
-            throws IOException {
-        return new Comparator(base.newComparator(reader, fieldname));
-    }
-
-    private static final class Comparator implements ScoreDocComparator {
-
-        private ScoreDocComparator base;
-
-        private Comparator(ScoreDocComparator base) {
-            this.base = base;
-        }
-
-        /**
-         * @see Util#compare(Comparable, Comparable)
-         */
-        public int compare(ScoreDoc i, ScoreDoc j) {
-            return Util.compare(sortValue(i), sortValue(j));
-        }
-
-        public Comparable sortValue(ScoreDoc i) {
-            Comparable c = base.sortValue(i);
-            if (c != null) {
-                return c.toString().toLowerCase();
-            } else {
-                return null;
+    @Override
+    public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
+        FieldComparator comparator = base.newComparator(fieldname, numHits, sortPos, reversed);
+        assert comparator instanceof FieldComparatorBase;
+
+        return new FieldComparatorDecorator((FieldComparatorBase) comparator) {
+            @Override
+            protected Comparable sortValue(int doc) {
+                Comparable c = super.sortValue(doc);
+                return c == null ? null : c.toString().toLowerCase();
             }
-        }
-
-        public int sortType() {
-            return SortField.CUSTOM;
-        }
+        };
     }
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java Thu Jan 27 09:33:13 2011
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.query
 
 import java.io.IOException;
 
+import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Scorer;
@@ -46,17 +47,22 @@ public class LuceneQueryHits implements 
                            Query query)
             throws IOException {
         this.reader = reader;
-        this.scorer = query.weight(searcher).scorer(reader);
+        // We rely on Scorer#nextDoc() and Scorer#advance(int) so enable
+        // scoreDocsInOrder
+        this.scorer = query.weight(searcher).scorer(reader, true, false);
     }
 
     /**
      * {@inheritDoc}
      */
     public ScoreNode nextScoreNode() throws IOException {
-        if (!scorer.next()) {
+        if (scorer == null) {
+            return null;
+        }
+        int doc = scorer.nextDoc();
+        if (doc == DocIdSetIterator.NO_MORE_DOCS) {
             return null;
         }
-        int doc = scorer.doc();
         NodeId id = new NodeId(reader.document(
                 doc, FieldSelectors.UUID).get(FieldNames.UUID));
         return new ScoreNode(id, scorer.score(), doc);
@@ -66,8 +72,10 @@ public class LuceneQueryHits implements 
      * {@inheritDoc}
      */
     public void close() throws IOException {
-        // make sure scorer frees resources
-        scorer.skipTo(Integer.MAX_VALUE);
+        if (scorer != null) {
+            // make sure scorer frees resources
+            scorer.advance(Integer.MAX_VALUE);
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java Thu Jan 27 09:33:13 2011
@@ -26,6 +26,7 @@ import java.io.IOException;
  * <code>MatchAllDocsQuery</code> extends the lucene <code>MatchAllDocsQuery</code>
  * and in addition implements {@link JackrabbitQuery}.
  */
+@SuppressWarnings("serial")
 public class MatchAllDocsQuery
         extends org.apache.lucene.search.MatchAllDocsQuery
         implements JackrabbitQuery {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java?rev=1064058&r1=1064057&r2=1064058&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java Thu Jan 27 09:33:13 2011
@@ -26,6 +26,7 @@ import java.util.Set;
  * Specialized query that returns / scores all pages in the search index.
  * <p>Use this Query to perform a match '*'.
  */
+@SuppressWarnings("serial")
 class MatchAllQuery extends Query {
 
     private final String field;
@@ -54,7 +55,7 @@ class MatchAllQuery extends Query {
      * @param searcher the current searcher.
      * @return the <code>Weight</code> for this Query.
      */
-    protected Weight createWeight(Searcher searcher) {
+    public Weight createWeight(Searcher searcher) {
         return new MatchAllWeight(this, searcher, field, cache);
     }
 



Mime
View raw message