|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ScoreDocComparator | Line # 29 | 14 | 10 | 92.9% |
0.9285714
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (19) | |||
| Result | |||
|
0.9285714
|
org.apache.lucene.search.TestSort.testNormalizedScores
org.apache.lucene.search.TestSort.testNormalizedScores
|
1 PASS | |
|
0.9285714
|
org.apache.lucene.search.TestSort.testReverseSort
org.apache.lucene.search.TestSort.testReverseSort
|
1 PASS | |
|
0.9285714
|
org.apache.lucene.search.TestSort.testBuiltInSorts
org.apache.lucene.search.TestSort.testBuiltInSorts
|
1 PASS | |
|
0.71428573
|
org.apache.lucene.search.TestSort.testTopDocsScores
org.apache.lucene.search.TestSort.testTopDocsScores
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestBoolean2.testRandomQueries
org.apache.lucene.search.TestBoolean2.testRandomQueries
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestSort.testAutoSort
org.apache.lucene.search.TestSort.testAutoSort
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestSort.testParallelMultiSort
org.apache.lucene.search.TestSort.testParallelMultiSort
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestSort.testMultiSort
org.apache.lucene.search.TestSort.testMultiSort
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestSort.testRemoteSort
org.apache.lucene.search.TestSort.testRemoteSort
|
1 PASS | |
|
0.42857143
|
org.apache.lucene.search.TestSort.testTypedSort
org.apache.lucene.search.TestSort.testTypedSort
|
1 PASS | |
|
0.35714287
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
|
1 PASS | |
|
0.35714287
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
|
1 PASS | |
|
0.35714287
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
|
1 PASS | |
|
0.2857143
|
org.apache.lucene.search.TestMultiSearcher.testNormalization10
org.apache.lucene.search.TestMultiSearcher.testNormalization10
|
1 PASS | |
|
0.2857143
|
org.apache.lucene.search.TestSort.testSortCombos
org.apache.lucene.search.TestSort.testSortCombos
|
1 PASS | |
|
0.2857143
|
org.apache.lucene.search.TestMultiSearcher.testNormalization10
org.apache.lucene.search.TestMultiSearcher.testNormalization10
|
1 PASS | |
|
0.14285715
|
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
|
1 PASS | |
|
0.14285715
|
org.apache.lucene.search.TestSort.testEmptyIndex
org.apache.lucene.search.TestSort.testEmptyIndex
|
1 PASS | |
|
0.14285715
|
org.apache.lucene.search.TestSort.testEmptyFieldSort
org.apache.lucene.search.TestSort.testEmptyFieldSort
|
1 PASS | |
| 1 | package org.apache.lucene.search; | |
| 2 | ||
| 3 | /** | |
| 4 | * Copyright 2004 The Apache Software Foundation | |
| 5 | * | |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | * you may not use this file except in compliance with the License. | |
| 8 | * You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, software | |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | * See the License for the specific language governing permissions and | |
| 16 | * limitations under the License. | |
| 17 | */ | |
| 18 | ||
| 19 | ||
| 20 | /** | |
| 21 | * Expert: Compares two ScoreDoc objects for sorting. | |
| 22 | * | |
| 23 | * <p>Created: Feb 3, 2004 9:00:16 AM | |
| 24 | * | |
| 25 | * @author Tim Jones (Nacimiento Software) | |
| 26 | * @since lucene 1.4 | |
| 27 | * @version $Id: ScoreDocComparator.java 150348 2004-05-19 23:05:27Z tjones $ | |
| 28 | */ | |
| 29 | public interface ScoreDocComparator { | |
| 30 | ||
| 31 | /** Special comparator for sorting hits according to computed relevance (document score). */ | |
| 32 | static final ScoreDocComparator RELEVANCE = new ScoreDocComparator() { | |
| 33 | 12629 |
public int compare (ScoreDoc i, ScoreDoc j) { |
| 34 | 12629 | if (i.score > j.score) return -1; |
| 35 | 12563 | if (i.score < j.score) return 1; |
| 36 | 12453 | return 0; |
| 37 | } | |
| 38 | 3003 |
public Comparable sortValue (ScoreDoc i) { |
| 39 | 3003 | return new Float (i.score); |
| 40 | } | |
| 41 | 74 |
public int sortType() { |
| 42 | 74 | return SortField.SCORE; |
| 43 | } | |
| 44 | }; | |
| 45 | ||
| 46 | ||
| 47 | /** Special comparator for sorting hits according to index order (document number). */ | |
| 48 | static final ScoreDocComparator INDEXORDER = new ScoreDocComparator() { | |
| 49 | 3708 |
public int compare (ScoreDoc i, ScoreDoc j) { |
| 50 | 3708 | if (i.doc < j.doc) return -1; |
| 51 | 2090 | if (i.doc > j.doc) return 1; |
| 52 | 0 | return 0; |
| 53 | } | |
| 54 | 3626 |
public Comparable sortValue (ScoreDoc i) { |
| 55 | 3626 | return new Integer (i.doc); |
| 56 | } | |
| 57 | 4372 |
public int sortType() { |
| 58 | 4372 | return SortField.DOC; |
| 59 | } | |
| 60 | }; | |
| 61 | ||
| 62 | ||
| 63 | /** | |
| 64 | * Compares two ScoreDoc objects and returns a result indicating their | |
| 65 | * sort order. | |
| 66 | * @param i First ScoreDoc | |
| 67 | * @param j Second ScoreDoc | |
| 68 | * @return <code>-1</code> if <code>i</code> should come before <code>j</code><br><code>1</code> if <code>i</code> should come after <code>j</code><br><code>0</code> if they are equal | |
| 69 | * @see java.util.Comparator | |
| 70 | */ | |
| 71 | int compare (ScoreDoc i, ScoreDoc j); | |
| 72 | ||
| 73 | ||
| 74 | /** | |
| 75 | * Returns the value used to sort the given document. The | |
| 76 | * object returned must implement the java.io.Serializable | |
| 77 | * interface. This is used by multisearchers to determine how to collate results from their searchers. | |
| 78 | * @see FieldDoc | |
| 79 | * @param i Document | |
| 80 | * @return Serializable object | |
| 81 | */ | |
| 82 | Comparable sortValue (ScoreDoc i); | |
| 83 | ||
| 84 | ||
| 85 | /** | |
| 86 | * Returns the type of sort. Should return <code>SortField.SCORE</code>, <code>SortField.DOC</code>, <code>SortField.STRING</code>, <code>SortField.INTEGER</code>, | |
| 87 | * <code>SortField.FLOAT</code> or <code>SortField.CUSTOM</code>. It is not valid to return <code>SortField.AUTO</code>. | |
| 88 | * This is used by multisearchers to determine how to collate results from their searchers. | |
| 89 | * @return One of the constants in SortField. | |
| 90 | * @see SortField | |
| 91 | */ | |
| 92 | int sortType(); | |
| 93 | } | |
|
||||||||||