jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebast...@apache.org
Subject svn commit: r1060863 [1/2] - in /jackrabbit/sandbox/JCR-2415-lucene-3.0: ./ 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/...
Date Wed, 19 Jan 2011 16:51:09 GMT
Author: sebastien
Date: Wed Jan 19 16:51:07 2011
New Revision: 1060863

URL: http://svn.apache.org/viewvc?rev=1060863&view=rev
Log:
JCR-2415 Update Lucene to 3.0

- change dependency to use Lucene 2.9.4 (incremental upgrade)
- remove most of the deprecated classes/methods
- JR HitCollector => Lucene Collector => JR AbstractHitCollector
- use new Scorer abstract class with new  boolean params scoreDocsInOrder and topScorer
- use Version.LUCENE_24 for backward compatibility (JackrabbitQueryParser, JackrabbitAnalyzer, StandardAnalyzer, MoreLikeThis)
- creating the directory in FSDirectoryManager (not done by Lucene anymore?)
- use Java 5 generics when appropriate
- use @SuppressWarnings annotation with "unchecked", "serial" and "rawtypes"

Added:
    jackrabbit/sandbox/JCR-2415-lucene-3.0/
      - copied from r1060859, jackrabbit/trunk/
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AbstractHitCollector.java
Modified:
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeTraversingQueryHits.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NotQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/OffsetCharSequence.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ParentAxisQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RefCountingIndexReader.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimilarityQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/TermDocsCache.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardNameQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/directory/FSDirectoryManager.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/SameNodeJoinMerger.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/ScoreNodeMap.java
    jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-parent/pom.xml

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java Wed Jan 19 16:51:07 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 = (OffsetAttribute) ts.getAttribute(OffsetAttribute.class);
+                TermAttribute term = (TermAttribute) ts.getAttribute(TermAttribute.class);
+                String termText = term.term();
                 TermVectorOffsetInfo[] info = termMap.get(termText);
                 if (info == null) {
                     info = new TermVectorOffsetInfo[1];
@@ -244,9 +246,10 @@ 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();
         } catch (IOException e) {
             // should never happen, we are reading from a string
         }

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java Wed Jan 19 16:51:07 2011
@@ -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);
@@ -499,7 +492,7 @@ abstract class AbstractIndex {
             for (Fieldable f : (List<Fieldable>) 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
@@ -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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractWeight.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java Wed Jan 19 16:51:07 2011
@@ -33,6 +33,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 {
 
     /**
@@ -42,7 +43,8 @@ abstract class CaseTermQuery extends Mul
     protected final int transform;
 
     CaseTermQuery(Term term, int transform) {
-        super(term);
+        super();
+        this.term = term;
         this.transform = transform;
     }
 
@@ -76,9 +78,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);

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java Wed Jan 19 16:51:07 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);
@@ -440,19 +442,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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultQueryHits.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java Wed Jan 19 16:51:07 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);
         }
@@ -311,8 +313,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 +323,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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java Wed Jan 19 16:51:07 2011
@@ -17,8 +17,8 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.DocIdSetIterator;
 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;
@@ -26,6 +26,7 @@ import org.apache.lucene.search.Similari
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Sort;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.query.lucene.hits.AbstractHitCollector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,6 +44,7 @@ import java.util.Iterator;
  * 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 +173,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 +323,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 +378,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);
         }
@@ -449,18 +452,18 @@ class DescendantSelfAxisQuery extends Qu
          */
         public boolean next() throws IOException {
             collectContextHits();
-            if (!subScorer.next() || contextHits.isEmpty()) {
+            int nextDoc = subScorer.nextDoc();
+            if (nextDoc == DocIdSetIterator.NO_MORE_DOCS || contextHits.isEmpty()) {
                 return false;
             }
-            int nextDoc = subScorer.doc();
-            while (nextDoc > -1) {
+            while (nextDoc != DocIdSetIterator.NO_MORE_DOCS) {
 
                 if (isValid(nextDoc)) {
                     return true;
                 }
 
                 // try next
-                nextDoc = subScorer.next() ? subScorer.doc() : -1;
+                nextDoc = subScorer.nextDoc();
             }
             return false;
         }
@@ -469,7 +472,7 @@ class DescendantSelfAxisQuery extends Qu
          * {@inheritDoc}
          */
         public int doc() {
-            return subScorer.doc();
+            return subScorer.docID();
         }
 
         /**
@@ -483,10 +486,10 @@ class DescendantSelfAxisQuery extends Qu
          * {@inheritDoc}
          */
         public boolean skipTo(int target) throws IOException {
-            boolean match = subScorer.skipTo(target);
-            if (match) {
+            int docId = subScorer.nextDoc();
+            if (docId != DocIdSetIterator.NO_MORE_DOCS) {
                 collectContextHits();
-                return isValid(subScorer.doc()) || next();
+                return isValid(docId) || next();
             } else {
                 return false;
             }
@@ -495,8 +498,9 @@ class DescendantSelfAxisQuery extends Qu
         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

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderScoreNodeIterator.java Wed Jan 19 16:51:07 2011
@@ -270,6 +270,7 @@ class DocOrderScoreNodeIterator implemen
     /**
      * Indicates that sorting failed.
      */
+    @SuppressWarnings("serial")
     private static final class SortFailedException extends RuntimeException {
     }
 }

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FieldSelectors.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IDField.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexDeletionPolicyImpl.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexHistory.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMigration.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitAnalyzer.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java Wed Jan 19 16:51:07 2011
@@ -106,6 +106,11 @@ public final class JackrabbitIndexReader
         return reader.getIndexReaders();
     }
 
+    public IndexReader[] getSequentialSubReaders() {
+      // No sequential sub-readers
+      return null;
+    }
+
     /**
      * {@inheritDoc}
      */

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java Wed Jan 19 16:51:07 2011
@@ -51,6 +51,7 @@ import org.xml.sax.SAXException;
  *
  * @since Apache Jackrabbit 2.0
  */
+@SuppressWarnings("serial")
 class JackrabbitParser implements Parser {
 
     /**

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitQueryParser.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTermQuery.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java Wed Jan 19 16:51:07 2011
@@ -42,6 +42,7 @@ import org.xml.sax.helpers.DefaultHandle
  *
  * @see #isExtractorFinished()
  */
+@SuppressWarnings("serial")
 public class LazyTextExtractorField extends AbstractField {
 
     /**

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameQuery.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LocalNameRangeQuery.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllDocsQuery.java Wed Jan 19 16:51:07 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/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllQuery.java Wed Jan 19 16:51:07 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);
     }
 

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java Wed Jan 19 16:51:07 2011
@@ -20,8 +20,8 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermEnum;
+import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Similarity;
 
@@ -84,9 +84,11 @@ class MatchAllScorer extends Scorer {
     /**
      * {@inheritDoc}
      */
-    public void score(HitCollector hc) throws IOException {
+    public void score(Collector collector) throws IOException {
+        collector.setScorer(this);
+
         while (next()) {
-            hc.collect(doc(), score());
+            collector.collect(doc());
         }
     }
 

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MatchAllWeight.java Wed Jan 19 16:51:07 2011
@@ -28,6 +28,7 @@ import java.io.IOException;
 /**
  * This class implements the Weight calculation for the MatchAllQuery.
  */
+@SuppressWarnings("serial")
 class MatchAllWeight extends AbstractWeight {
 
     /**
@@ -76,7 +77,8 @@ class MatchAllWeight extends AbstractWei
      * @param reader index reader
      * @return a {@link MatchAllScorer} instance
      */
-    protected Scorer createScorer(IndexReader reader) throws IOException {
+    protected Scorer createScorer(IndexReader reader, boolean scoreDocsInOrder,
+            boolean topScorer) throws IOException {
         return new MatchAllScorer(reader, field, cache);
     }
 

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java Wed Jan 19 16:51:07 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.util.PriorityQueue;
+import org.apache.lucene.util.Version;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermFreqVector;
@@ -27,11 +28,12 @@ import org.apache.lucene.search.TermQuer
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.analysis.tokenattributes.TermAttribute;
 import org.apache.lucene.document.Document;
 
+import java.util.List;
 import java.util.Set;
 import java.util.HashMap;
 import java.util.Map;
@@ -152,7 +154,7 @@ public final class MoreLikeThis {
      * Default analyzer to parse source doc with.
      * @see #getAnalyzer
      */
-    public static final Analyzer DEFAULT_ANALYZER = new StandardAnalyzer();
+    public static final Analyzer DEFAULT_ANALYZER = new StandardAnalyzer(Version.LUCENE_24);
 
     /**
      * Ignore terms with less than this frequency in the source doc.
@@ -202,12 +204,12 @@ public final class MoreLikeThis {
      * @see #setStopWords
      * @see #getStopWords
      */
-    public static final Set DEFAULT_STOP_WORDS = null;
+    public static final Set<String> DEFAULT_STOP_WORDS = null;
 
     /**
      * Current set of stop words.
      */
-    private Set stopWords = DEFAULT_STOP_WORDS;
+    private Set<String> stopWords = DEFAULT_STOP_WORDS;
 
     /**
      * Return a Query with no more than this many terms.
@@ -448,7 +450,7 @@ public final class MoreLikeThis {
      * @see org.apache.lucene.analysis.StopFilter#makeStopSet StopFilter.makeStopSet()
      * @see #getStopWords
      */
-    public void setStopWords(Set stopWords) {
+    public void setStopWords(Set<String> stopWords) {
         this.stopWords = stopWords;
     }
 
@@ -456,7 +458,7 @@ public final class MoreLikeThis {
      * Get the current stop words being used.
      * @see #setStopWords
      */
-    public Set getStopWords() {
+    public Set<String> getStopWords() {
         return stopWords;
     }
 
@@ -504,8 +506,9 @@ public final class MoreLikeThis {
     public Query like(int docNum) throws IOException {
         if (fieldNames == null) {
             // gather list of valid fields from lucene
-            Collection fields = ir.getFieldNames( IndexReader.FieldOption.INDEXED);
-            fieldNames = (String[]) fields.toArray(new String[fields.size()]);
+            @SuppressWarnings("unchecked")
+            Collection<String> fields = ir.getFieldNames(IndexReader.FieldOption.INDEXED);
+            fieldNames = fields.toArray(new String[fields.size()]);
         }
 
         return createQuery(retrieveTerms(docNum));
@@ -519,8 +522,9 @@ public final class MoreLikeThis {
     public Query like(File f) throws IOException {
         if (fieldNames == null) {
             // gather list of valid fields from lucene
-            Collection fields = ir.getFieldNames( IndexReader.FieldOption.INDEXED);
-            fieldNames = (String[]) fields.toArray(new String[fields.size()]);
+            @SuppressWarnings("unchecked")
+            Collection<String> fields = ir.getFieldNames(IndexReader.FieldOption.INDEXED);
+            fieldNames = fields.toArray(new String[fields.size()]);
         }
 
         return like(new FileReader(f));
@@ -596,14 +600,14 @@ public final class MoreLikeThis {
      *
      * @param words a map of words keyed on the word(String) with Int objects as the values.
      */
-    private PriorityQueue createQueue(Map words) throws IOException {
+    private PriorityQueue createQueue(Map<String, Int> words) throws IOException {
         // have collected all words in doc and their freqs
         int numDocs = ir.numDocs();
         FreqQ res = new FreqQ(words.size()); // will order words by score
 
-        Iterator it = words.keySet().iterator();
+        Iterator<String> it = words.keySet().iterator();
         while (it.hasNext()) { // for every word
-            String word = (String) it.next();
+            String word = it.next();
 
             int tf = ((Int) words.get(word)).x; // term freq in the source doc
             if (minTermFreq > 0 && tf < minTermFreq) {
@@ -631,7 +635,7 @@ public final class MoreLikeThis {
             float score = tf * idf;
 
             // only really need 1st 3 entries, other ones are for troubleshooting
-            res.insert(new Object[]{word,                   // the word
+            res.insertWithOverflow(new Object[]{word,                   // the word
                                     topField,               // the top field
                                     new Float(score),       // overall score
                                     new Float(idf),         // idf
@@ -670,7 +674,7 @@ public final class MoreLikeThis {
      * @param docNum the id of the lucene document from which to find terms
      */
     public PriorityQueue retrieveTerms(int docNum) throws IOException {
-        Map termFreqMap = new HashMap();
+        Map<String, Int> termFreqMap = new HashMap<String, Int>();
         for (int i = 0; i < fieldNames.length; i++) {
             String fieldName = fieldNames[i];
             TermFreqVector vector = ir.getTermFreqVector(docNum, fieldName);
@@ -699,7 +703,7 @@ public final class MoreLikeThis {
      * @param termFreqMap a Map of terms and their frequencies
      * @param vector List of terms and their frequencies for a doc/field
      */
-    private void addTermFrequencies(Map termFreqMap, TermFreqVector vector) {
+    private void addTermFrequencies(Map<String, Int> termFreqMap, TermFreqVector vector) {
         String[] terms = vector.getTerms();
         int[] freqs = vector.getTermFrequencies();
         for (int j = 0; j < terms.length; j++) {
@@ -727,14 +731,14 @@ public final class MoreLikeThis {
      * @param termFreqMap a Map of terms and their frequencies
      * @param fieldName Used by analyzer for any special per-field analysis
      */
-    private void addTermFrequencies(Reader r, Map termFreqMap, String fieldName)
+    private void addTermFrequencies(Reader r, Map<String, Int> termFreqMap, String fieldName)
             throws IOException {
         TokenStream ts = analyzer.tokenStream(fieldName, r);
         int tokenCount = 0;
         // for every token
-        final Token reusableToken = new Token();
-        for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
-            String word = nextToken.term();
+        while (ts.incrementToken()) {
+            TermAttribute term = (TermAttribute) ts.getAttribute(TermAttribute.class);
+            String word =  term.term();
             tokenCount++;
             if (tokenCount > maxNumTokensParsed) {
                 break;
@@ -796,7 +800,7 @@ public final class MoreLikeThis {
      * @see #retrieveInterestingTerms
      */
     public PriorityQueue retrieveTerms(Reader r) throws IOException {
-        Map words = new HashMap();
+        Map<String, Int> words = new HashMap<String, Int>();
         for (int i = 0; i < fieldNames.length; i++) {
             String fieldName = fieldNames[i];
             addTermFrequencies(r, words, fieldName);
@@ -808,17 +812,16 @@ public final class MoreLikeThis {
      * @see #retrieveInterestingTerms(java.io.Reader)
      */
     public String[] retrieveInterestingTerms(int docNum) throws IOException {
-        ArrayList al = new ArrayList(maxQueryTerms);
+        List<String> al = new ArrayList<String>(maxQueryTerms);
         PriorityQueue pq = retrieveTerms(docNum);
         Object cur;
         int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
         // we just want to return the top words
         while (((cur = pq.pop()) != null) && lim-- > 0) {
             Object[] ar = (Object[]) cur;
-            al.add(ar[0]); // the 1st entry is the interesting word
+            al.add((String) ar[0]); // the 1st entry is the interesting word
         }
-        String[] res = new String[al.size()];
-        return (String[]) al.toArray(res);
+        return al.toArray(new String[al.size()]);
     }
 
     /**
@@ -831,17 +834,16 @@ public final class MoreLikeThis {
      * @see #setMaxQueryTerms
      */
     public String[] retrieveInterestingTerms(Reader r) throws IOException {
-        ArrayList al = new ArrayList(maxQueryTerms);
+        List<String> al = new ArrayList<String>(maxQueryTerms);
         PriorityQueue pq = retrieveTerms(r);
         Object cur;
         int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
         // we just want to return the top words
         while (((cur = pq.pop()) != null) && lim-- > 0) {
             Object[] ar = (Object[]) cur;
-            al.add(ar[0]); // the 1st entry is the interesting word
+            al.add((String) ar[0]); // the 1st entry is the interesting word
         }
-        String[] res = new String[al.size()];
-        return (String[]) al.toArray(res);
+        return al.toArray(new String[al.size()]);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiScorer.java Wed Jan 19 16:51:07 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
+import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.Explanation;
 import org.apache.lucene.search.Similarity;
 
 import java.io.IOException;
@@ -68,7 +68,7 @@ class MultiScorer extends Scorer {
      */
     public boolean next() throws IOException {
         while (hasNext) {
-            if (scorers[current].next()) {
+            if (scorers[current].nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
                 return true;
             } else if (++current < scorers.length) {
                 // advance to next scorer
@@ -84,7 +84,7 @@ class MultiScorer extends Scorer {
      * {@inheritDoc}
      */
     public int doc() {
-        return scorers[current].doc() + starts[current];
+        return scorers[current].docID() + starts[current];
     }
 
     /**
@@ -99,7 +99,7 @@ class MultiScorer extends Scorer {
      */
     public boolean skipTo(int target) throws IOException {
         current = scorerIndex(target);
-        if (scorers[current].skipTo(target - starts[current])) {
+        if (scorers[current].advance(target - starts[current]) != DocIdSetIterator.NO_MORE_DOCS) {
             return true;
         } else {
             if (++current < scorers.length) {
@@ -113,14 +113,6 @@ class MultiScorer extends Scorer {
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public Explanation explain(int doc) throws IOException {
-        int scorerIndex = scorerIndex(doc);
-        return scorers[scorerIndex].explain(doc - starts[scorerIndex]);
-    }
-
     //--------------------------< internal >------------------------------------
 
     /**

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameQuery.java Wed Jan 19 16:51:07 2011
@@ -30,6 +30,7 @@ import java.util.Set;
 /**
  * <code>NameQuery</code> implements a query for the name of a node.
  */
+@SuppressWarnings("serial")
 public class NameQuery extends Query {
 
     /**

Modified: jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.java?rev=1060863&r1=1060859&r2=1060863&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.java (original)
+++ jackrabbit/sandbox/JCR-2415-lucene-3.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NameRangeQuery.java Wed Jan 19 16:51:07 2011
@@ -30,6 +30,7 @@ import java.io.IOException;
 /**
  * <code>NameRangeQuery</code>...
  */
+@SuppressWarnings("serial")
 public class NameRangeQuery extends Query {
 
     /**



Mime
View raw message