From 3e75ec8daee2d699493f59390d297d6e99feec98 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Wed, 11 Feb 2009 02:30:13 +0000 Subject: [PATCH] SOLR-998: current lucene libs, SolrIndexReader introduction for FileFloatSource fix git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@743196 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 + lib/lucene-analyzers-2.9-dev.jar | 2 +- lib/lucene-core-2.9-dev.jar | 2 +- lib/lucene-highlighter-2.9-dev.jar | 2 +- lib/lucene-memory-2.9-dev.jar | 2 +- lib/lucene-queries-2.9-dev.jar | 2 +- lib/lucene-snowball-2.9-dev.jar | 2 +- lib/lucene-spellchecker-2.9-dev.jar | 2 +- .../apache/solr/search/SolrIndexReader.java | 395 ++++++++++++++++++ .../apache/solr/search/SolrIndexSearcher.java | 19 +- .../solr/search/function/FileFloatSource.java | 22 +- 11 files changed, 435 insertions(+), 18 deletions(-) create mode 100755 src/java/org/apache/solr/search/SolrIndexReader.java diff --git a/CHANGES.txt b/CHANGES.txt index 244642b4619..86876bd17da 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -297,7 +297,10 @@ Other Changes 16. SOLR-959: Refactored TestReplicationHandler to remove hardcoded port numbers (hossman, Akshay Ukey via shalin) +17. Upgraded to Lucene 2.9-dev r742220 (yonik) + Build + ---------------------- 1. SOLR-776: Added in ability to sign artifacts via Ant for releases (gsingers) diff --git a/lib/lucene-analyzers-2.9-dev.jar b/lib/lucene-analyzers-2.9-dev.jar index 715b5a40454..99813f55c34 100644 --- a/lib/lucene-analyzers-2.9-dev.jar +++ b/lib/lucene-analyzers-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[a5d31a9409eaf23aa468d310c2efea973ff0b1c2] was removed in git history. +AnyObjectId[233ed5db218f6903ac3c0ece661252d6407064b6] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-core-2.9-dev.jar b/lib/lucene-core-2.9-dev.jar index 00a0f2a9f68..7cc4c503128 100644 --- a/lib/lucene-core-2.9-dev.jar +++ b/lib/lucene-core-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[aff681d711db092c4a0223a4c83ed54bf2f1fc65] was removed in git history. +AnyObjectId[31b0d33aa1da2bf13d6bf51e9be394a33b1ab0a3] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-highlighter-2.9-dev.jar b/lib/lucene-highlighter-2.9-dev.jar index be43a160379..b73813b90df 100644 --- a/lib/lucene-highlighter-2.9-dev.jar +++ b/lib/lucene-highlighter-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[ec07b9376ad892ca3c65fcce6d4fe39e5842f287] was removed in git history. +AnyObjectId[038a5f87ce9318fce477e7462e9b42453906061c] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-memory-2.9-dev.jar b/lib/lucene-memory-2.9-dev.jar index f3d002375c3..349982becdf 100644 --- a/lib/lucene-memory-2.9-dev.jar +++ b/lib/lucene-memory-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[252b5fc02fe9c59f5333284c4d31b617d0917833] was removed in git history. +AnyObjectId[42c58436c087c6f1065ab4bdc595672a7e53c663] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-queries-2.9-dev.jar b/lib/lucene-queries-2.9-dev.jar index 3d16978e7e1..33ebb13fdd5 100644 --- a/lib/lucene-queries-2.9-dev.jar +++ b/lib/lucene-queries-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[3e54e93a41abdff89af393081f67b6675b7125ce] was removed in git history. +AnyObjectId[65a1349b447909deaef0f3dc1a08d85382151633] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-snowball-2.9-dev.jar b/lib/lucene-snowball-2.9-dev.jar index 89dd2612ff6..a8d0805bb7c 100644 --- a/lib/lucene-snowball-2.9-dev.jar +++ b/lib/lucene-snowball-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[461d1b7f1fc8850ef9bbde6e987866282a514db0] was removed in git history. +AnyObjectId[ec5b95ed8d08e88804da07a13e954670e58b3afe] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/lib/lucene-spellchecker-2.9-dev.jar b/lib/lucene-spellchecker-2.9-dev.jar index 587ee412a36..0e55b6b49fe 100644 --- a/lib/lucene-spellchecker-2.9-dev.jar +++ b/lib/lucene-spellchecker-2.9-dev.jar @@ -1,2 +1,2 @@ -AnyObjectId[582f579a54e931e0aab5900d6a1573633e105903] was removed in git history. +AnyObjectId[62c06f36f735835d7effebce4ca377171d61f743] was removed in git history. Apache SVN contains full history. \ No newline at end of file diff --git a/src/java/org/apache/solr/search/SolrIndexReader.java b/src/java/org/apache/solr/search/SolrIndexReader.java new file mode 100755 index 00000000000..6134ef2b6ec --- /dev/null +++ b/src/java/org/apache/solr/search/SolrIndexReader.java @@ -0,0 +1,395 @@ +/** + * 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.solr.search; + + +import org.apache.lucene.index.*; +import org.apache.lucene.store.Directory; +import org.apache.lucene.store.LockObtainFailedException; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.FieldSelector; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; + +/** Solr wrapper for IndexReader that contains extra context. + * This is currently experimental, for internal use only, and subject to change. + */ +public class SolrIndexReader extends FilterIndexReader { + private final SolrIndexReader[] subReaders; + private final SolrIndexReader parent; + private final int base; // docid offset of this reader within parent + + // top level searcher for this reader tree + // a bit if a hack currently... searcher needs to set + SolrIndexSearcher searcher; + + // Shared info about the wrapped reader. + private SolrReaderInfo info; + + /** Recursively wrap an IndexReader in SolrIndexReader instances. + * @param in the reader to wrap + * @param parent the parent, if any (null if none) + * @param base the docid offset in the parent (0 if top level) + */ + public SolrIndexReader(IndexReader in, SolrIndexReader parent, int base) { + super(in); + assert(!(in instanceof SolrIndexReader)); + this.parent = parent; + this.base = base; + IndexReader subs[] = in.getSequentialSubReaders(); + subReaders = subs == null ? null : new SolrIndexReader[subs.length]; + if (subs != null) { + int b=0; + for (int i=0; i