|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FieldSortedHitQueue | Line # 41 | 133 | 57 | 95.3% |
0.95327103
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (24) | |||
| Result | |||
|
0.8831776
|
org.apache.lucene.search.TestSort.testParallelMultiSort
org.apache.lucene.search.TestSort.testParallelMultiSort
|
1 PASS | |
|
0.8831776
|
org.apache.lucene.search.TestSort.testMultiSort
org.apache.lucene.search.TestSort.testMultiSort
|
1 PASS | |
|
0.8831776
|
org.apache.lucene.search.TestSort.testRemoteSort
org.apache.lucene.search.TestSort.testRemoteSort
|
1 PASS | |
|
0.87383175
|
org.apache.lucene.search.TestSort.testEmptyFieldSort
org.apache.lucene.search.TestSort.testEmptyFieldSort
|
1 PASS | |
|
0.7429907
|
org.apache.lucene.search.TestSort.testNormalizedScores
org.apache.lucene.search.TestSort.testNormalizedScores
|
1 PASS | |
|
0.7429907
|
org.apache.lucene.search.TestSort.testReverseSort
org.apache.lucene.search.TestSort.testReverseSort
|
1 PASS | |
|
0.72897196
|
org.apache.lucene.search.TestSort.testAutoSort
org.apache.lucene.search.TestSort.testAutoSort
|
1 PASS | |
|
0.71495324
|
org.apache.lucene.search.TestSort.testSortCombos
org.apache.lucene.search.TestSort.testSortCombos
|
1 PASS | |
|
0.7009346
|
org.apache.lucene.search.TestSort.testTypedSort
org.apache.lucene.search.TestSort.testTypedSort
|
1 PASS | |
|
0.5186916
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
|
1 PASS | |
|
0.5186916
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
|
1 PASS | |
|
0.5186916
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
|
1 PASS | |
|
0.47196263
|
org.apache.lucene.search.TestSort.testInternationalSort
org.apache.lucene.search.TestSort.testInternationalSort
|
1 PASS | |
|
0.47196263
|
org.apache.lucene.search.TestSort.testLocaleSort
org.apache.lucene.search.TestSort.testLocaleSort
|
1 PASS | |
|
0.46728972
|
org.apache.lucene.search.TestSort.testInternationalMultiSearcherSort
org.apache.lucene.search.TestSort.testInternationalMultiSearcherSort
|
1 PASS | |
|
0.39719626
|
org.apache.lucene.search.TestSort.testEmptyIndex
org.apache.lucene.search.TestSort.testEmptyIndex
|
1 PASS | |
|
0.37850466
|
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
|
1 PASS | |
|
0.37850466
|
org.apache.lucene.search.TestSort.testCustomSorts
org.apache.lucene.search.TestSort.testCustomSorts
|
1 PASS | |
|
0.3504673
|
org.apache.lucene.search.TestSort.testRemoteCustomSort
org.apache.lucene.search.TestSort.testRemoteCustomSort
|
1 PASS | |
|
0.24299066
|
org.apache.lucene.search.TestSort.testTopDocsScores
org.apache.lucene.search.TestSort.testTopDocsScores
|
1 PASS | |
|
0.24299066
|
org.apache.lucene.search.TestSort.testBuiltInSorts
org.apache.lucene.search.TestSort.testBuiltInSorts
|
1 PASS | |
|
0.22429906
|
org.apache.lucene.search.TestBoolean2.testRandomQueries
org.apache.lucene.search.TestBoolean2.testRandomQueries
|
1 PASS | |
|
0.18224299
|
org.apache.lucene.search.TestMultiSearcher.testNormalization10
org.apache.lucene.search.TestMultiSearcher.testNormalization10
|
1 PASS | |
|
0.18224299
|
org.apache.lucene.search.TestMultiSearcher.testNormalization10
org.apache.lucene.search.TestMultiSearcher.testNormalization10
|
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 | import org.apache.lucene.index.IndexReader; | |
| 20 | import org.apache.lucene.util.PriorityQueue; | |
| 21 | ||
| 22 | import java.io.IOException; | |
| 23 | import java.util.WeakHashMap; | |
| 24 | import java.util.HashMap; | |
| 25 | import java.util.Map; | |
| 26 | import java.util.Locale; | |
| 27 | import java.text.Collator; | |
| 28 | ||
| 29 | /** | |
| 30 | * Expert: A hit queue for sorting by hits by terms in more than one field. | |
| 31 | * Uses <code>FieldCache.DEFAULT</code> for maintaining internal term lookup tables. | |
| 32 | * | |
| 33 | * <p>Created: Dec 8, 2003 12:56:03 PM | |
| 34 | * | |
| 35 | * @author Tim Jones (Nacimiento Software) | |
| 36 | * @since lucene 1.4 | |
| 37 | * @version $Id: FieldSortedHitQueue.java 433049 2006-08-20 21:17:59Z hossman $ | |
| 38 | * @see Searcher#search(Query,Filter,int,Sort) | |
| 39 | * @see FieldCache | |
| 40 | */ | |
| 41 | public class FieldSortedHitQueue | |
| 42 | extends PriorityQueue { | |
| 43 | ||
| 44 | /** | |
| 45 | * Creates a hit queue sorted by the given list of fields. | |
| 46 | * @param reader Index to use. | |
| 47 | * @param fields Fieldable names, in priority order (highest priority first). Cannot be <code>null</code> or empty. | |
| 48 | * @param size The number of hits to retain. Must be greater than zero. | |
| 49 | * @throws IOException | |
| 50 | */ | |
| 51 | 2281 |
public FieldSortedHitQueue (IndexReader reader, SortField[] fields, int size) |
| 52 | throws IOException { | |
| 53 | 2281 | final int n = fields.length; |
| 54 | 2281 | comparators = new ScoreDocComparator[n]; |
| 55 | 2281 | this.fields = new SortField[n]; |
| 56 | 4790 | for (int i=0; i<n; ++i) { |
| 57 | 2509 | String fieldname = fields[i].getField(); |
| 58 | 2509 | comparators[i] = getCachedComparator (reader, fieldname, fields[i].getType(), fields[i].getLocale(), fields[i].getFactory()); |
| 59 | ||
| 60 | 2509 | if (comparators[i].sortType() == SortField.STRING) { |
| 61 | 92 | this.fields[i] = new SortField (fieldname, fields[i].getLocale(), fields[i].getReverse()); |
| 62 | } else { | |
| 63 | 2417 | this.fields[i] = new SortField (fieldname, comparators[i].sortType(), fields[i].getReverse()); |
| 64 | } | |
| 65 | } | |
| 66 | 2281 | initialize (size); |
| 67 | } | |
| 68 | ||
| 69 | ||
| 70 | /** Stores a comparator corresponding to each field being sorted by */ | |
| 71 | protected ScoreDocComparator[] comparators; | |
| 72 | ||
| 73 | /** Stores the sort criteria being used. */ | |
| 74 | protected SortField[] fields; | |
| 75 | ||
| 76 | /** Stores the maximum score value encountered, needed for normalizing. */ | |
| 77 | protected float maxscore = Float.NEGATIVE_INFINITY; | |
| 78 | ||
| 79 | /** returns the maximum score encountered by elements inserted via insert() | |
| 80 | */ | |