LUCENE-5207: simplify

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1523394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-09-15 03:42:15 +00:00
parent c2a261dbdd
commit 6c6564f2be
6 changed files with 36 additions and 13 deletions

View File

@ -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);

View File

@ -54,11 +54,6 @@ class ExpressionFunctionValues extends FunctionValues {
@Override
public String toString(int document) {
if (currentDocument != document) {
currentDocument = document;
currentValue = expression.evaluate(document, functionValues);
}
return "ExpressionFunctionValues(" + document + ": " + currentValue + ")";
return "ExpressionFunctionValues(" + document + ": " + objectVal(document) + ")";
}
}

View File

@ -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);

View File

@ -0,0 +1 @@
f8b86f4ee6e02082f63a658e00eb5506821253c6

View File

@ -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.

View File

@ -0,0 +1 @@