jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r633843 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/
Date Wed, 05 Mar 2008 13:41:25 GMT
Author: mreutegg
Date: Wed Mar  5 05:41:08 2008
New Revision: 633843

URL: http://svn.apache.org/viewvc?rev=633843&view=rev
Log:
JCR-1104: JSR 283 support
- multiple selectors (work in progress)

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.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/DescendantSelfAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderNodeIteratorImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexSearcher.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIteratorImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHits.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNodeIterator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java Wed Mar  5 05:41:08 2008
@@ -163,4 +163,8 @@
      */
     public abstract boolean needsSystemTree();
 
+    /**
+     * @return the selector names for this query.
+     */
+    public abstract Name[] getSelectorNames();
 }

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=633843&r1=633842&r2=633843&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 Wed Mar  5 05:41:08 2008
@@ -216,7 +216,7 @@
             throws IOException {
         if (sort.getSort().length == 0 && matchesAnyChildNode()) {
             Query context = getContextQuery();
-            return new ChildNodesQueryHits(searcher.execute(context, sort), session);
+            return new ChildNodesQueryHits(searcher.evaluate(context, sort), session);
         } else {
             return null;
         }

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java?rev=633843&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java Wed Mar  5 05:41:08 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.query.lucene;
+
+import java.io.IOException;
+
+/**
+ * Defines an interface for query hits that need to be closed when done reading
+ * from it. A client will call {@link #close()} to release resources after a
+ * query has been executed and the results have been read.
+ */
+public interface CloseableHits {
+
+    /**
+     * Releases resources held by this hits instance.
+     *
+     * @throws IOException if an error occurs while releasing resources.
+     */
+    void close() throws IOException;
+
+    /**
+     * @return the number of results or <code>-1</code> if the size is unknown.
+     */
+    int getSize();
+
+    /**
+     * Skips a <code>n</code> score nodes.
+     *
+     * @param n the number of score nodes to skip.
+     * @throws IOException if an error occurs while skipping.
+     */
+    void skip(int n) throws IOException;
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CloseableHits.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=633843&r1=633842&r2=633843&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 Wed Mar  5 05:41:08 2008
@@ -217,7 +217,7 @@
         if (sort.getSort().length == 0 && subQueryMatchesAll()) {
             // maps path String to NodeId
             Map startingPoints = new TreeMap();
-            QueryHits result = searcher.execute(getContextQuery(), sort);
+            QueryHits result = searcher.evaluate(getContextQuery(), sort);
             try {
                 // minLevels 0 and 1 are handled with a series of
                 // NodeTraversingQueryHits directly on result. For minLevels >= 2

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderNodeIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderNodeIteratorImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderNodeIteratorImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocOrderNodeIteratorImpl.java Wed Mar  5 05:41:08 2008
@@ -41,22 +41,34 @@
     /** A node iterator with ordered nodes */
     private NodeIteratorImpl orderedNodes;
 
-    /** Unordered list of {@link ScoreNode}s. */
+    /** Unordered list of {@link ScoreNode}[]s. */
     private final List scoreNodes;
 
     /** ItemManager to turn UUIDs into Node instances */
     protected final ItemManager itemMgr;
 
     /**
+     * Apply document order on the score nodes with this selectorIndex.
+     */
+    private final int selectorIndex;
+
+    /**
      * Creates a <code>DocOrderNodeIteratorImpl</code> that orders the nodes in
      * <code>scoreNodes</code> in document order.
      *
-     * @param itemMgr    the item manager of the session executing the query.
-     * @param scoreNodes the ids of the matching nodes with their score value.
-     */
-    DocOrderNodeIteratorImpl(final ItemManager itemMgr, List scoreNodes) {
+     * @param itemMgr       the item manager of the session executing the
+     *                      query.
+     * @param scoreNodes    the ids of the matching nodes with their score
+     *                      value. <code>List&lt;ScoreNode[]></code>
+     * @param selectorIndex apply document order on the score nodes with this
+     *                      selectorIndex.
+     */
+    DocOrderNodeIteratorImpl(ItemManager itemMgr,
+                             List scoreNodes,
+                             int selectorIndex) {
         this.itemMgr = itemMgr;
         this.scoreNodes = scoreNodes;
+        this.selectorIndex = selectorIndex;
     }
 
     /**
@@ -140,6 +152,14 @@
         return orderedNodes.getScore();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public ScoreNode[] getScoreNodes() {
+        initOrderedIterator();
+        return orderedNodes.getScoreNodes();
+    }
+
     //------------------------< internal >--------------------------------------
 
     /**
@@ -150,7 +170,7 @@
             return;
         }
         long time = System.currentTimeMillis();
-        ScoreNode[] nodes = (ScoreNode[]) scoreNodes.toArray(new ScoreNode[scoreNodes.size()]);
+        ScoreNode[][] nodes = (ScoreNode[][]) scoreNodes.toArray(new ScoreNode[scoreNodes.size()][]);
 
         final List invalidIDs = new ArrayList(2);
 
@@ -159,11 +179,11 @@
                 // previous sort run was not successful -> remove failed uuids
                 List tmp = new ArrayList();
                 for (int i = 0; i < nodes.length; i++) {
-                    if (!invalidIDs.contains(nodes[i].getNodeId())) {
+                    if (!invalidIDs.contains(nodes[i][selectorIndex].getNodeId())) {
                         tmp.add(nodes[i]);
                     }
                 }
-                nodes = (ScoreNode[]) tmp.toArray(new ScoreNode[tmp.size()]);
+                nodes = (ScoreNode[][]) tmp.toArray(new ScoreNode[tmp.size()][]);
                 invalidIDs.clear();
             }
 
@@ -171,8 +191,17 @@
                 // sort the uuids
                 Arrays.sort(nodes, new Comparator() {
                     public int compare(Object o1, Object o2) {
-                        ScoreNode n1 = (ScoreNode) o1;
-                        ScoreNode n2 = (ScoreNode) o2;
+                        ScoreNode n1 = ((ScoreNode[]) o1)[selectorIndex];
+                        ScoreNode n2 = ((ScoreNode[]) o2)[selectorIndex];
+                        // handle null values
+                        // null is considered less than any value
+                        if (n1 == n2) {
+                            return 0;
+                        } else if (n1 == null) {
+                            return -1;
+                        } else if (n2 == null) {
+                            return 1;
+                        }
                         try {
                             NodeImpl node1;
                             try {
@@ -257,7 +286,7 @@
         if (log.isDebugEnabled()) {
             log.debug("" + nodes.length + " node(s) ordered in " + (System.currentTimeMillis() - time) + " ms");
         }
-        orderedNodes = new NodeIteratorImpl(itemMgr, nodes);
+        orderedNodes = new NodeIteratorImpl(itemMgr, nodes, selectorIndex);
     }
 
     /**

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java?rev=633843&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java Wed Mar  5 05:41:08 2008
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.query.lucene;
+
+import org.apache.jackrabbit.spi.Name;
+
+import java.io.IOException;
+
+/**
+ * <code>FilterMultiColumnQueryHits</code> implements a
+ * {@link MultiColumnQueryHits} filter that forwards each call to the underlying
+ * query hits.
+ */
+public class FilterMultiColumnQueryHits implements MultiColumnQueryHits {
+
+    /**
+     * The underlying query hits.
+     */
+    private final MultiColumnQueryHits hits;
+
+    /**
+     * Creates a new <code>FilterMultiColumnQueryHits</code>, which forwards
+     * each call to <code>hits</code>.
+     *
+     * @param hits the underlying query hits.
+     */
+    public FilterMultiColumnQueryHits(MultiColumnQueryHits hits) {
+        this.hits = hits;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        hits.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getSize() {
+        return hits.getSize();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ScoreNode[] nextScoreNodes() throws IOException {
+        return hits.nextScoreNodes();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Name[] getSelectorNames() {
+        return hits.getSelectorNames();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void skip(int n) throws IOException {
+        hits.skip(n);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FilterMultiColumnQueryHits.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexSearcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexSearcher.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexSearcher.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexSearcher.java Wed Mar  5 05:41:08 2008
@@ -60,7 +60,20 @@
      * @return the query hits.
      * @throws IOException if an error occurs while executing the query.
      */
-    public QueryHits execute(Query query, Sort sort) throws IOException {
+    public MultiColumnQueryHits execute(Query query, Sort sort) throws IOException {
+        return new QueryHitsAdapter(evaluate(query, sort),
+                QueryImpl.DEFAULT_SELECTOR_NAME);
+    }
+
+    /**
+     * Evaluates the query and returns the hits that match the query.
+     *
+     * @param query the query to execute.
+     * @param sort  the sort criteria.
+     * @return the query hits.
+     * @throws IOException if an error occurs while executing the query.
+     */
+    public QueryHits evaluate(Query query, Sort sort) throws IOException {
         query = query.rewrite(reader);
         QueryHits hits = null;
         if (query instanceof JackrabbitQuery) {

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java?rev=633843&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java Wed Mar  5 05:41:08 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.query.lucene;
+
+import org.apache.jackrabbit.spi.Name;
+
+import java.io.IOException;
+
+/**
+ * <code>MultiColumnQueryHits</code> defines an interface for reading tuples of
+ * {@link ScoreNode}s. The {@link ScoreNode}s within a tuple are identified by
+ * selector {@link Name}s.
+ */
+public interface MultiColumnQueryHits extends CloseableHits {
+
+    /**
+     * Returns the next score nodes in this QueryHits or <code>null</code> if
+     * there are no more score nodes.
+     *
+     * @return the next score nodes in this QueryHits.
+     * @throws IOException if an error occurs while reading from the index.
+     */
+    ScoreNode[] nextScoreNodes() throws IOException;
+
+    /**
+     * @return the selector names that correspond to the {@link ScoreNode}s
+     *         returned by {@link #nextScoreNodes()}.
+     */
+    Name[] getSelectorNames();
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiColumnQueryHits.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIteratorImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIteratorImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIteratorImpl.java Wed Mar  5 05:41:08 2008
@@ -35,7 +35,10 @@
     private static final Logger log = LoggerFactory.getLogger(NodeIteratorImpl.class);
 
     /** The node ids of the nodes in the result set with their score value */
-    protected final ScoreNode[] scoreNodes;
+    protected final ScoreNode[][] scoreNodes;
+
+    /** The index for the default selector withing {@link #scoreNodes} */
+    private final int selectorIndex;
 
     /** ItemManager to turn UUIDs into Node instances */
     protected final ItemManager itemMgr;
@@ -51,14 +54,19 @@
 
     /**
      * Creates a new <code>NodeIteratorImpl</code> instance.
-     * @param itemMgr the <code>ItemManager</code> to turn UUIDs into
-     *   <code>Node</code> instances.
-     * @param scoreNodes the node ids of the matching nodes.
+     *
+     * @param itemMgr       the <code>ItemManager</code> to turn UUIDs into
+     *                      <code>Node</code> instances.
+     * @param scoreNodes    the node ids of the matching nodes.
+     * @param selectorIndex the index for the default selector within
+     *                      <code>scoreNodes</code>.
      */
     NodeIteratorImpl(ItemManager itemMgr,
-                     ScoreNode[] scoreNodes) {
+                     ScoreNode[][] scoreNodes,
+                     int selectorIndex) {
         this.itemMgr = itemMgr;
         this.scoreNodes = scoreNodes;
+        this.selectorIndex = selectorIndex;
         fetchNext();
     }
 
@@ -169,7 +177,14 @@
         if (!hasNext()) {
             throw new NoSuchElementException();
         }
-        return scoreNodes[pos].getScore();
+        return scoreNodes[pos][selectorIndex].getScore();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ScoreNode[] getScoreNodes() {
+        return scoreNodes[pos];
     }
 
     /**
@@ -183,10 +198,10 @@
         next = null;
         while (next == null && (pos + 1) < scoreNodes.length) {
             try {
-                next = (NodeImpl) itemMgr.getItem(scoreNodes[pos + 1].getNodeId());
+                next = (NodeImpl) itemMgr.getItem(scoreNodes[pos + 1][selectorIndex].getNodeId());
             } catch (RepositoryException e) {
                 log.warn("Exception retrieving Node with UUID: "
-                        + scoreNodes[pos + 1].getNodeId() + ": " + e.toString());
+                        + scoreNodes[pos + 1][selectorIndex].getNodeId() + ": " + e.toString());
                 // try next
                 invalid++;
                 pos++;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHits.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHits.java Wed Mar  5 05:41:08 2008
@@ -19,23 +19,9 @@
 import java.io.IOException;
 
 /**
- * Defines an interface for reading query hits. A client will call {@link
- * #close()} to release resources after a query has been executed and the
- * results have been read.
+ * Defines an interface for reading {@link ScoreNode}s
  */
-public interface QueryHits {
-
-    /**
-     * Releases resources held by this hits instance.
-     *
-     * @throws IOException if an error occurs while releasing resources.
-     */
-    void close() throws IOException;
-
-    /**
-     * @return the number of results or <code>-1</code> if the size is unknown.
-     */
-    int getSize();
+public interface QueryHits extends CloseableHits {
 
     /**
      * Returns the next score node in this QueryHits or <code>null</code> if
@@ -45,12 +31,4 @@
      * @throws IOException if an error occurs while reading from the index.
      */
     ScoreNode nextScoreNode() throws IOException;
-
-    /**
-     * Skips a <code>n</code> score nodes.
-     *
-     * @param n the number of score nodes to skip.
-     * @throws IOException if an error occurs while skipping.
-     */
-    void skip(int n) throws IOException;
 }

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java?rev=633843&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java Wed Mar  5 05:41:08 2008
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.query.lucene;
+
+import org.apache.jackrabbit.spi.Name;
+
+import java.io.IOException;
+
+/**
+ * <code>QueryHitsAdapter</code> implements an adapter for {@link QueryHits} and
+ * exposes them as {@link MultiColumnQueryHits}.
+ */
+public class QueryHitsAdapter implements MultiColumnQueryHits {
+
+    /**
+     * The query hits to adapt.
+     */
+    private final QueryHits hits;
+
+    /**
+     * The single selector name to expose.
+     */
+    private final Name selectorName;
+
+    /**
+     * Creates a new adapter for <code>hits</code>.
+     *
+     * @param hits the query hits to adapt.
+     * @param selectorName the single selector name for the query hits.
+     */
+    public QueryHitsAdapter(QueryHits hits, Name selectorName) {
+        this.hits = hits;
+        this.selectorName = selectorName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ScoreNode[] nextScoreNodes() throws IOException {
+        ScoreNode sn = hits.nextScoreNode();
+        if (sn != null) {
+            return new ScoreNode[]{sn};
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Name[] getSelectorNames() {
+        return new Name[]{selectorName};
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        hits.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getSize() {
+        return hits.getSize();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void skip(int n) throws IOException {
+        hits.skip(n);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java Wed Mar  5 05:41:08 2008
@@ -23,12 +23,12 @@
 import org.apache.jackrabbit.core.query.PropertyTypeRegistry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.query.AndQueryNode;
 import org.apache.jackrabbit.spi.commons.query.DefaultQueryNodeVisitor;
 import org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode;
 import org.apache.jackrabbit.spi.commons.query.NodeTypeQueryNode;
 import org.apache.jackrabbit.spi.commons.query.OrderQueryNode;
-import org.apache.jackrabbit.spi.commons.query.PathQueryNode;
 import org.apache.jackrabbit.spi.commons.query.QueryNodeFactory;
 import org.apache.jackrabbit.spi.commons.query.QueryParser;
 import org.apache.jackrabbit.spi.commons.query.QueryRootNode;
@@ -56,9 +56,9 @@
     private static final Logger log = LoggerFactory.getLogger(QueryImpl.class);
 
     /**
-     * Represents a query that selects all nodes. E.g. in XPath: //*
+     * The default selector name 's'.
      */
-    protected final QueryRootNode allNodesQueryNode;
+    public static final Name DEFAULT_SELECTOR_NAME = NameFactoryImpl.getInstance().create("", "s");
 
     /**
      * The root node of the query tree
@@ -90,7 +90,6 @@
         // build query tree using the passed factory
         this.root = QueryParser.parse(statement, language,
                 session.getNamePathResolver(), factory);
-        allNodesQueryNode = createMatchAllNodesQuery(factory);
     }
 
     /**
@@ -195,25 +194,10 @@
         return this.root.needsSystemTree();
     }
 
-    //----------------------------< internal >----------------------------------
-
     /**
-     * Creates an abstract query tree that matches all nodes. XPath example:
-     * //element(*, nt:base)
-     *
-     * @param factory the query node factory.
-     * @return the abstract query tree.
+     * {@inheritDoc}
      */
-    private static QueryRootNode createMatchAllNodesQuery(
-            QueryNodeFactory factory) {
-        QueryRootNode allNodesQueryNode = factory.createQueryRootNode();
-        PathQueryNode pathNode = factory.createPathQueryNode(allNodesQueryNode);
-        LocationStepQueryNode lsNode = factory.createLocationStepQueryNode(pathNode);
-        lsNode.setNameTest(null);
-        lsNode.setIncludeDescendants(true);
-        pathNode.addPathStep(lsNode);
-        pathNode.setAbsolute(true);
-        allNodesQueryNode.setLocationNode(pathNode);
-        return allNodesQueryNode;
+    public Name[] getSelectorNames() {
+        return new Name[]{DEFAULT_SELECTOR_NAME};
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java Wed Mar  5 05:41:08 2008
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.spi.commons.query.qom.OrderingImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.DefaultTraversingQOMTreeVisitor;
 import org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl;
+import org.apache.jackrabbit.spi.commons.query.qom.SelectorImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.spi.Name;
@@ -70,6 +71,18 @@
     public boolean needsSystemTree() {
         // TODO: analyze QOM tree
         return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */ 
+    public Name[] getSelectorNames() {
+        SelectorImpl[] selectors = qomTree.getSource().getSelectors();
+        Name[] names = new Name[selectors.length];
+        for (int i = 0; i < names.length; i++) {
+            names[i] = selectors[i].getSelectorQName();
+        };
+        return names;
     }
 
     //-------------------------< ExecutableQuery >------------------------------

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java Wed Mar  5 05:41:08 2008
@@ -100,6 +100,8 @@
     /**
      * The result nodes including their score. This list is populated on a lazy
      * basis while a client iterates through the results.
+     * <p/>
+     * The exact type is: <code>List&lt;ScoreNode[]></code>
      */
     private final List resultNodes = new ArrayList();
 
@@ -225,7 +227,8 @@
             }
         }
         return new RowIteratorImpl(getNodeIterator(), selectProps,
-                session, excerptProvider, spellSuggestion);
+                queryImpl.getSelectorNames(), itemMgr, session,
+                excerptProvider, spellSuggestion);
     }
 
     /**
@@ -235,7 +238,7 @@
      * @return hits for this query result.
      * @throws IOException if an error occurs while executing the query.
      */
-    protected QueryHits executeQuery() throws IOException {
+    protected MultiColumnQueryHits executeQuery() throws IOException {
         return index.executeQuery(session, queryImpl,
                 query, orderProps, orderSpecs);
     }
@@ -249,9 +252,9 @@
      */
     private ScoreNodeIterator getNodeIterator() {
         if (docOrder) {
-            return new DocOrderNodeIteratorImpl(itemMgr, resultNodes);
+            return new DocOrderNodeIteratorImpl(itemMgr, resultNodes, 0);
         } else {
-            return new LazyScoreNodeIterator();
+            return new LazyScoreNodeIterator(0);
         }
     }
 
@@ -283,7 +286,7 @@
         }
 
         // execute it
-        QueryHits result = null;
+        MultiColumnQueryHits result = null;
         try {
             long time = System.currentTimeMillis();
             result = executeQuery();
@@ -293,12 +296,12 @@
             int start = resultNodes.size() + invalid + (int) offset;
             time = System.currentTimeMillis();
             result.skip(start);
-            for (ScoreNode sn = result.nextScoreNode();
+            for (ScoreNode[] sn = result.nextScoreNodes();
                  sn != null && resultNodes.size() < maxResultSize;
-                 sn = result.nextScoreNode()) {
+                 sn = result.nextScoreNodes()) {
                 // check access
                 try {
-                    if (accessMgr.isGranted(sn.getNodeId(), AccessManager.READ)) {
+                    if (isAccessGranted(sn)) {
                         resultNodes.add(sn);
                     } else {
                         invalid++;
@@ -328,6 +331,28 @@
     }
 
     /**
+     * Checks if access is granted to all <code>nodes</code>.
+     *
+     * @param nodes the nodes to check.
+     * @return <code>true</code> if read access is granted to all
+     *         <code>nodes</code>.
+     * @throws ItemNotFoundException if one of the <code>nodes</code> is not
+     *                               found.
+     * @throws RepositoryException   if an error occurs while checking access
+     *                               rights.
+     */
+    private boolean isAccessGranted(ScoreNode[] nodes)
+            throws ItemNotFoundException, RepositoryException {
+        for (int i = 0; i < nodes.length; i++) {
+            if (nodes[i] != null && !accessMgr.isGranted(
+                    nodes[i].getNodeId(), AccessManager.READ)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
      * Returns the total number of hits. This is the number of results you
      * will get get if you don't set any limit or offset. Keep in mind that this
      * number may get smaller if nodes are found in the result set which the
@@ -350,6 +375,12 @@
 
         private NodeImpl next;
 
+        private final int selectorIndex;
+
+        private LazyScoreNodeIterator(int selectorIndex) {
+            this.selectorIndex = selectorIndex;
+        }
+
         /**
          * {@inheritDoc}
          */
@@ -358,7 +389,18 @@
             if (!hasNext()) {
                 throw new NoSuchElementException();
             }
-            return ((ScoreNode) resultNodes.get(position)).getScore();
+            return ((ScoreNode[]) resultNodes.get(position))[selectorIndex].getScore();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public ScoreNode[] getScoreNodes() {
+            initialize();
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            return (ScoreNode[]) resultNodes.get(position);
         }
 
         /**
@@ -502,12 +544,12 @@
                         break;
                     }
                 }
-                ScoreNode sn = (ScoreNode) resultNodes.get(nextPos);
+                ScoreNode[] sn = (ScoreNode[]) resultNodes.get(nextPos);
                 try {
-                    next = (NodeImpl) itemMgr.getItem(sn.getNodeId());
+                    next = (NodeImpl) itemMgr.getItem(sn[selectorIndex].getNodeId());
                 } catch (RepositoryException e) {
                     log.warn("Exception retrieving Node with UUID: "
-                            + sn.getNodeId() + ": " + e.toString());
+                            + sn[selectorIndex].getNodeId() + ": " + e.toString());
                     // remove score node and try next
                     resultNodes.remove(nextPos);
                     invalid++;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java Wed Mar  5 05:41:08 2008
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
 import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -44,6 +45,8 @@
 import java.util.HashSet;
 import java.util.NoSuchElementException;
 import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
 import java.io.IOException;
 
 /**
@@ -90,6 +93,16 @@
     private final Name[] properties;
 
     /**
+     * List of valid selector {@link Name}s.
+     */
+    private final List selectorNames = new ArrayList();
+
+    /**
+     * The item manager of the session that executes the query.
+     */
+    private final ItemManager itemMgr;
+
+    /**
      * The <code>NamePathResolver</code> of the user <code>Session</code>.
      */
     private final NamePathResolver resolver;
@@ -108,22 +121,12 @@
      * Creates a new <code>RowIteratorImpl</code> that iterates over the result
      * nodes.
      *
-     * @param nodes      a <code>ScoreNodeIterator</code> that contains the nodes of
-     *                   the query result.
-     * @param properties <code>Name</code> of the select properties.
-     * @param resolver   <code>NamespaceResolver</code> of the user
-     */
-    RowIteratorImpl(ScoreNodeIterator nodes, Name[] properties, NamePathResolver resolver) {
-        this(nodes, properties, resolver, null, null);
-    }
-
-    /**
-     * Creates a new <code>RowIteratorImpl</code> that iterates over the result
-     * nodes.
-     *
      * @param nodes           a <code>ScoreNodeIterator</code> that contains the
      *                        nodes of the query result.
      * @param properties      <code>Name</code> of the select properties.
+     * @param selectorNames   the selector names.
+     * @param itemMgr         the item manager of the session that executes the
+     *                        query.
      * @param resolver        <code>NamespaceResolver</code> of the user
      *                        <code>Session</code>.
      * @param exProvider      the excerpt provider associated with the query
@@ -133,11 +136,15 @@
      */
     RowIteratorImpl(ScoreNodeIterator nodes,
                     Name[] properties,
+                    Name[] selectorNames,
+                    ItemManager itemMgr,
                     NamePathResolver resolver,
                     ExcerptProvider exProvider,
                     SpellSuggestion spellSuggestion) {
         this.nodes = nodes;
         this.properties = properties;
+        this.selectorNames.addAll(Arrays.asList(selectorNames));
+        this.itemMgr = itemMgr;
         this.resolver = resolver;
         this.excerptProvider = exProvider;
         this.spellSuggestion = spellSuggestion;
@@ -151,7 +158,8 @@
      *                                <code>Row</code>s.
      */
     public Row nextRow() throws NoSuchElementException {
-        return new RowImpl(nodes.getScore(), nodes.nextNodeImpl());
+        return new RowImpl(nodes.getScore(),
+                nodes.getScoreNodes(), nodes.nextNodeImpl());
     }
 
     /**
@@ -235,6 +243,11 @@
         private final NodeImpl node;
 
         /**
+         * The score nodes associated with this row.
+         */
+        private final ScoreNode[] sn;
+
+        /**
          * Cached value array for returned by {@link #getValues()}.
          */
         private Value[] values;
@@ -248,10 +261,12 @@
          * Creates a new <code>RowImpl</code> instance based on <code>node</code>.
          *
          * @param score the score value for this result row
+         * @param sn    the score nodes associated with this row.
          * @param node  the underlying <code>Node</code> for this <code>Row</code>.
          */
-        RowImpl(float score, NodeImpl node) {
+        RowImpl(float score, ScoreNode[] sn, NodeImpl node) {
             this.score = score;
+            this.sn = sn;
             this.node = node;
         }
 
@@ -379,6 +394,7 @@
          * @since JCR 2.0
          */
         public Node getNode() throws RepositoryException {
+            checkSingleSelector("Use getNode(String) instead.");
             return node;
         }
 
@@ -393,8 +409,12 @@
          * @since JCR 2.0
          */
         public Node getNode(String selectorName) throws RepositoryException {
-            // TODO: implement
-            throw new UnsupportedOperationException("not yet implemented");
+            ScoreNode s = sn[getSelectorIndex(selectorName)];
+            if (s == null) {
+                // TODO correct?
+                return null;
+            }
+            return (Node) itemMgr.getItem(s.getNodeId());
         }
 
         /**
@@ -409,6 +429,7 @@
          * @since JCR 2.0
          */
         public String getPath() throws RepositoryException {
+            checkSingleSelector("Use getPath(String) instead.");
             return node.getPath();
         }
 
@@ -424,8 +445,12 @@
          * @since JCR 2.0
          */
         public String getPath(String selectorName) throws RepositoryException {
-            // TODO: implement
-            throw new UnsupportedOperationException("not yet implemented");
+            Node n = getNode(selectorName);
+            if (n != null) {
+                return n.getPath();
+            } else {
+                return null;
+            }
         }
 
         /**
@@ -449,6 +474,7 @@
          * @since JCR 2.0
          */
         public double getScore() throws RepositoryException {
+            checkSingleSelector("Use getScore(String) instead.");
             return score;
         }
 
@@ -473,11 +499,47 @@
          * @since JCR 2.0
          */
         public double getScore(String selectorName) throws RepositoryException {
-            // TODO: implement
-            throw new UnsupportedOperationException("not yet implemented");
+            ScoreNode s = sn[getSelectorIndex(selectorName)];
+            if (s == null) {
+                // TODO correct?
+                return Double.NaN;
+            }
+            return s.getScore();
         }
 
         //-----------------------------< internal >-----------------------------
+
+        /**
+         * Checks if there is a single selector and otherwise throws a
+         * RepositoryException.
+         *
+         * @param useInstead message telling, which method to use instead.
+         * @throws RepositoryException if there is more than one selector.
+         */
+        private void checkSingleSelector(String useInstead) throws RepositoryException {
+            if (sn.length > 1) {
+                String msg = "More than one selector. " + useInstead;
+                throw new RepositoryException(msg);
+            }
+        }
+
+        /**
+         * Gets the selector index for the given <code>selectorName</code>.
+         *
+         * @param selectorName the selector name.
+         * @return the selector index.
+         * @throws RepositoryException if the selector name is not a valid JCR
+         *                             name or the selector name is not the
+         *                             alias of a selector in this query.
+         */
+        private int getSelectorIndex(String selectorName)
+                throws RepositoryException {
+            int idx = selectorNames.indexOf(resolver.getQName(selectorName));
+            if (idx == -1) {
+                throw new RepositoryException("Unknown selector name: " + selectorName);
+            }
+            return idx;
+        }
 
         /**
          * @param name a Name.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNodeIterator.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNodeIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNodeIterator.java Wed Mar  5 05:41:08 2008
@@ -39,6 +39,16 @@
     float getScore();
 
     /**
+     * Returns the score nodes related to the node returned by
+     * {@link #nextNodeImpl()} but does not move the iterator forward.
+     *
+     * @return the score nodes related to the {@link #nextNodeImpl()}.
+     * @throws java.util.NoSuchElementException
+     *          if there is no next node.
+     */
+    ScoreNode[] getScoreNodes();
+
+    /**
      * Returns the next <code>Node</code> in the result set.
      *
      * @return the next <code>Node</code> in the result set.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=633843&r1=633842&r2=633843&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java Wed Mar  5 05:41:08 2008
@@ -642,10 +642,10 @@
      * @param orderSpecs the order specs for the sort order properties.
      * <code>true</code> indicates ascending order, <code>false</code> indicates
      * descending.
-     * @return the lucene Hits object.
+     * @return the query hits.
      * @throws IOException if an error occurs while searching the index.
      */
-    public QueryHits executeQuery(SessionImpl session,
+    public MultiColumnQueryHits executeQuery(SessionImpl session,
                                   AbstractQueryImpl queryImpl,
                                   Query query,
                                   Name[] orderProps,
@@ -655,7 +655,8 @@
         Sort sort = new Sort(createSortFields(orderProps, orderSpecs));
 
         final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
-        return new FilterQueryHits(new JackrabbitIndexSearcher(session, reader).execute(query, sort)) {
+        return new FilterMultiColumnQueryHits(new JackrabbitIndexSearcher(
+                session, reader).execute(query, sort)) {
             public void close() throws IOException {
                 try {
                     super.close();



Mime
View raw message