|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FieldCacheImpl | Line # 40 | 165 | 52 | 94.2% |
0.9419087
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FieldCacheImpl.Entry | Line # 44 | 19 | 11 | 85.4% |
0.85365856
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (19) | |||
| Result | |||
|
0.8014184
|
org.apache.lucene.search.TestSort.testEmptyFieldSort
org.apache.lucene.search.TestSort.testEmptyFieldSort
|
1 PASS | |
|
0.7907801
|
org.apache.lucene.search.TestSort.testParallelMultiSort
org.apache.lucene.search.TestSort.testParallelMultiSort
|
1 PASS | |
|
0.7907801
|
org.apache.lucene.search.TestSort.testMultiSort
org.apache.lucene.search.TestSort.testMultiSort
|
1 PASS | |
|
0.7907801
|
org.apache.lucene.search.TestSort.testRemoteSort
org.apache.lucene.search.TestSort.testRemoteSort
|
1 PASS | |
|
0.70212764
|
org.apache.lucene.search.TestSort.testAutoSort
org.apache.lucene.search.TestSort.testAutoSort
|
1 PASS | |
|
0.70212764
|
org.apache.lucene.search.TestSort.testNormalizedScores
org.apache.lucene.search.TestSort.testNormalizedScores
|
1 PASS | |
|
0.70212764
|
org.apache.lucene.search.TestSort.testReverseSort
org.apache.lucene.search.TestSort.testReverseSort
|
1 PASS | |
|
0.70212764
|
org.apache.lucene.search.TestSort.testSortCombos
org.apache.lucene.search.TestSort.testSortCombos
|
1 PASS | |
|
0.57092196
|
org.apache.lucene.search.TestSort.testTypedSort
org.apache.lucene.search.TestSort.testTypedSort
|
1 PASS | |
|
0.4539007
|
org.apache.lucene.search.TestSort.testEmptyIndex
org.apache.lucene.search.TestSort.testEmptyIndex
|
1 PASS | |
|
0.41489363
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortCustomSearcher
|
1 PASS | |
|
0.41489363
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortMultiCustomSearcher
|
1 PASS | |
|
0.41489363
|
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
org.apache.lucene.search.TestCustomSearcherSort.testFieldSortSingleSearcher
|
1 PASS | |
|
0.36524823
|
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
org.apache.lucene.search.TestFilteredQuery.testFilteredQuery
|
1 PASS | |
|
0.25177306
|
org.apache.lucene.search.TestSort.testInternationalSort
org.apache.lucene.search.TestSort.testInternationalSort
|
1 PASS | |
|
0.24822696
|
org.apache.lucene.search.TestSort.testInternationalMultiSearcherSort
org.apache.lucene.search.TestSort.testInternationalMultiSearcherSort
|
1 PASS | |
|
0.23049645
|
org.apache.lucene.search.TestSort.testCustomSorts
org.apache.lucene.search.TestSort.testCustomSorts
|
1 PASS | |
|
0.23049645
|
org.apache.lucene.search.TestSort.testLocaleSort
org.apache.lucene.search.TestSort.testLocaleSort
|
1 PASS | |
|
0.17375886
|
org.apache.lucene.search.TestSort.testRemoteCustomSort
org.apache.lucene.search.TestSort.testRemoteCustomSort
|
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.index.Term; | |
| 21 | import org.apache.lucene.index.TermDocs; | |
| 22 | import org.apache.lucene.index.TermEnum; | |
| 23 | ||
| 24 | import java.io.IOException; | |
| 25 | import java.util.Locale; | |
| 26 | import java.util.Map; | |
| 27 | import java.util.WeakHashMap; | |
| 28 | import java.util.HashMap; | |
| 29 | ||
| 30 | /** | |
| 31 | * Expert: The default cache implementation, storing all values in memory. | |
| 32 | * A WeakHashMap is used for storage. | |
| 33 | * | |
| 34 | * <p>Created: May 19, 2004 4:40:36 PM | |
| 35 | * | |
| 36 | * @author Tim Jones (Nacimiento Software) | |
| 37 | * @since lucene 1.4 | |
| 38 | * @version $Id: FieldCacheImpl.java 413201 2006-06-10 01:23:22Z gsingers $ | |
| 39 | */ | |
| 40 | class FieldCacheImpl | |
| 41 | implements FieldCache { | |
| 42 | ||
| 43 | /** Expert: Every key in the internal cache is of this type. */ | |
| 44 | static class Entry { | |
| 45 | final String field; // which Fieldable | |
| 46 | final int type; // which SortField type | |
| 47 | final Object custom; // which custom comparator | |
| 48 | final Locale locale; // the locale we're sorting (if string) | |
| 49 | ||
| 50 | /** Creates one of these objects. */ | |
| 51 | 502 |
Entry (String field, int type, Locale locale) { |
| 52 | 502 | this.field = field.intern(); |
| 53 | 502 | this.type = type; |
| 54 | 502 | this.custom = null; |
| 55 | 502 | this.locale = locale; |
| 56 | } | |
| 57 | ||
| 58 | /** Creates one of these objects for a custom comparator. */ | |
| 59 | 123 |
Entry (String field, Object custom) { |
| 60 | 123 | this.field = field.intern(); |
| 61 | 123 | this.type = SortField.CUSTOM; |
| 62 | 123 | this.custom = custom; |
| 63 | 123 | this.locale = null; |
| 64 | } | |
| 65 | ||
| 66 | /** Two of these are equal iff they reference the same field and type. */ | |
| 67 | 263 |
public boolean equals (Object o) { |
| 68 | 263 | if (o instanceof Entry) { |
| 69 | 263 | Entry other = (Entry) o; |
| 70 | 263 | if (other.field == field && other.type == type) { |
| 71 | 263 | if (other.locale == null ? locale == null : other.locale.equals(locale)) { |
| 72 | 263 | if (other.custom == null) { |
| 73 | 224 | if (custom == null) return true; |
| 74 | 39 | } else if (other.custom.equals (custom)) { |
| 75 | 39 | return true; |
| 76 | } | |
| 77 | } | |
| 78 | } | |
| 79 | } | |
| 80 | 0 | return false; |
| 81 | } | |
| 82 | ||
| 83 | /** Composes a hashcode based on the field and type. */ | |
| 84 | 567 |
public int hashCode() { |
| 85 | 567 | return field.hashCode() ^ type ^ (custom==null ? 0 : custom.hashCode()) ^ (locale==null ? 0 : locale.hashCode()); |
| 86 | } | |
| 87 | } | |
| 88 | ||
| 89 | private static final IntParser INT_PARSER = new IntParser() { | |
| 90 | 300 |
public int parseInt(String value) { |
| 91 | 300 | return Integer.parseInt(value); |
| 92 | } | |
| 93 | }; | |
| 94 | ||
| 95 | private static final FloatParser FLOAT_PARSER = new FloatParser() { | |
| 96 | 120 |
public float parseFloat(String value) { |
| 97 | 120 | return Float.parseFloat(value); |
| 98 | ||