Skip to content

Apache Lucene open-source search software

LUCENE-5207: simplify

Robert Muir6c6564f2be04
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
index 7ae1f294ffc..ec8151c96a4 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
@@ -126,19 +126,19 @@ public class TestSearchAfter extends LuceneTestCase {
}
void assertQuery(Query query, Filter filter, Sort sort) throws Exception {
- int maxDoc = searcher.getIndexReader().maxDoc();
+ int size = _TestUtil.nextInt(random(), 1, searcher.getIndexReader().maxDoc());
TopDocs all;
- int pageSize = _TestUtil.nextInt(random(), 1, maxDoc*2);
+ int pageSize = _TestUtil.nextInt(random(), 1, size*2);
if (VERBOSE) {
System.out.println("\nassertQuery: query=" + query + " filter=" + filter + " sort=" + sort + " pageSize=" + pageSize);
}
final boolean doMaxScore = random().nextBoolean();
if (sort == null) {
- all = searcher.search(query, filter, maxDoc);
+ all = searcher.search(query, filter, size);
} else if (sort == Sort.RELEVANCE) {
- all = searcher.search(query, filter, maxDoc, sort, true, doMaxScore);
+ all = searcher.search(query, filter, size, sort, true, doMaxScore);
} else {
- all = searcher.search(query, filter, maxDoc, sort);
+ all = searcher.search(query, filter, size, sort);
}
if (VERBOSE) {
System.out.println(" all.totalHits=" + all.totalHits);
diff --git a/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java b/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
index f710775291b..601c2486bfa 100644
--- a/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
+++ b/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionFunctionValues.java
@@ -53,12 +53,7 @@ class ExpressionFunctionValues extends FunctionValues {
}
@Override
- public String toString(int document) {
- if (currentDocument != document) {
- currentDocument = document;
- currentValue = expression.evaluate(document, functionValues);
- }
-
- return "ExpressionFunctionValues(" + document + ": " + currentValue + ")";
+ public String toString(int document) {
+ return "ExpressionFunctionValues(" + document + ": " + objectVal(document) + ")";
}
}
diff --git a/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionSorts.java b/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionSorts.java
index 84b2cb73220..0617577c40c 100644
--- a/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionSorts.java
+++ b/lucene/expressions/src/test/org/apache/lucene/expressions/TestExpressionSorts.java
@@ -104,7 +104,7 @@ public class TestExpressionSorts extends LuceneTestCase {
bq.add(new TermQuery(new Term("english", "one")), BooleanClause.Occur.SHOULD);
bq.add(new TermQuery(new Term("oddeven", "even")), BooleanClause.Occur.SHOULD);
assertQuery(bq, null);
- // force out of order
+ // force in order
bq.add(new TermQuery(new Term("english", "two")), BooleanClause.Occur.SHOULD);
bq.setMinimumNumberShouldMatch(2);
assertQuery(bq, null);
diff --git a/lucene/licenses/asm-commons-4.1.jar.sha1 b/lucene/licenses/asm-commons-4.1.jar.sha1
new file mode 100644
index 00000000000..2b534751bf1
--- /dev/null
+++ b/lucene/licenses/asm-commons-4.1.jar.sha1
@@ -0,0 +1 @@
+f8b86f4ee6e02082f63a658e00eb5506821253c6
diff --git a/lucene/licenses/asm-commons-LICENSE-BSD_LIKE.txt b/lucene/licenses/asm-commons-LICENSE-BSD_LIKE.txt
new file mode 100644
index 00000000000..afb064f2f26
--- /dev/null
+++ b/lucene/licenses/asm-commons-LICENSE-BSD_LIKE.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2012 France Télécom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/lucene/licenses/asm-commons-NOTICE.txt b/lucene/licenses/asm-commons-NOTICE.txt
new file mode 100644
index 00000000000..8d1c8b69c3f
--- /dev/null
+++ b/lucene/licenses/asm-commons-NOTICE.txt
@@ -0,0 +1 @@
+