|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConstantScoreQuery | Line # 32 | 11 | 9 | 95.8% |
0.9583333
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConstantScoreQuery.ConstantWeight | Line # 48 | 21 | 8 | 93.3% |
0.93333334
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConstantScoreQuery.ConstantScorer | Line # 103 | 10 | 6 | 87.5% |
0.875
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (20) | |||
| Result | |||
|
0.82857144
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ1
org.apache.lucene.search.TestSimpleExplanations.testCSQ1
|
1 PASS | |
|
0.82857144
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ3
org.apache.lucene.search.TestSimpleExplanations.testCSQ3
|
1 PASS | |
|
0.82857144
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ2
org.apache.lucene.search.TestSimpleExplanations.testCSQ2
|
1 PASS | |
|
0.7714286
|
org.apache.lucene.search.TestComplexExplanations.test1
org.apache.lucene.search.TestComplexExplanations.test1
|
1 PASS | |
|
0.7714286
|
org.apache.lucene.search.TestComplexExplanations.test2
org.apache.lucene.search.TestComplexExplanations.test2
|
1 PASS | |
|
0.75714284
|
org.apache.lucene.search.TestComplexExplanations.testCSQ4
org.apache.lucene.search.TestComplexExplanations.testCSQ4
|
1 PASS | |
|
0.5
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ2
org.apache.lucene.search.TestSimpleExplanations.testCSQ2
|
1 PASS | |
|
0.5
|
org.apache.lucene.search.TestComplexExplanations.test2
org.apache.lucene.search.TestComplexExplanations.test2
|
1 PASS | |
|
0.5
|
org.apache.lucene.search.TestComplexExplanations.testCSQ4
org.apache.lucene.search.TestComplexExplanations.testCSQ4
|
1 PASS | |
|
0.5
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ3
org.apache.lucene.search.TestSimpleExplanations.testCSQ3
|
1 PASS | |
|
0.5
|
org.apache.lucene.search.TestComplexExplanations.test1
org.apache.lucene.search.TestComplexExplanations.test1
|
1 PASS | |
|
0.45714286
|
org.apache.lucene.search.TestScorerPerf.testConjunctions
org.apache.lucene.search.TestScorerPerf.testConjunctions
|
1 PASS | |
|
0.45714286
|
org.apache.lucene.search.TestConstantScoreRangeQuery.testBooleanOrderUnAffected
org.apache.lucene.search.TestConstantScoreRangeQuery.testBooleanOrderUnAffected
|
1 PASS | |
|
0.44285715
|
org.apache.lucene.search.TestRemoteSearchable.testConstantScoreQuery
org.apache.lucene.search.TestRemoteSearchable.testConstantScoreQuery
|
1 PASS | |
|
0.41428572
|
org.apache.lucene.search.TestConstantScoreRangeQuery.testRangeQueryId
org.apache.lucene.search.TestConstantScoreRangeQuery.testRangeQueryId
|
1 PASS | |
|
0.41428572
|
org.apache.lucene.search.TestConstantScoreRangeQuery.testBoost
org.apache.lucene.search.TestConstantScoreRangeQuery.testBoost
|
1 PASS | |
|
0.41428572
|
org.apache.lucene.search.TestPrefixFilter.testPrefixFilter
org.apache.lucene.search.TestPrefixFilter.testPrefixFilter
|
1 PASS | |
|
0.41428572
|
org.apache.lucene.search.TestConstantScoreRangeQuery.testRangeQueryRand
org.apache.lucene.search.TestConstantScoreRangeQuery.testRangeQueryRand
|
1 PASS | |
|
0.41428572
|
org.apache.lucene.search.TestConstantScoreRangeQuery.testEqualScores
org.apache.lucene.search.TestConstantScoreRangeQuery.testEqualScores
|
1 PASS | |
|
0.071428575
|
org.apache.lucene.search.TestSimpleExplanations.testCSQ1
org.apache.lucene.search.TestSimpleExplanations.testCSQ1
|
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 | ||
| 21 | import java.io.IOException; | |
| 22 | import java.util.BitSet; | |
| 23 | import java.util.Set; | |
| 24 | ||
| 25 | /** | |
| 26 | * A query that wraps a filter and simply returns a constant score equal to the | |
| 27 | * query boost for every document in the filter. | |
| 28 | * | |
| 29 | * @author yonik | |
| 30 | * @version $Id: ConstantScoreQuery.java 417275 2006-06-26 18:38:47Z hossman $ | |
| 31 | */ | |
| 32 | public class ConstantScoreQuery extends Query { | |
| 33 | protected final Filter filter; | |
| 34 | ||
| 35 | 97563 |
public ConstantScoreQuery(Filter filter) { |
| 36 | 97563 | this.filter=filter; |
| 37 | } | |
| 38 | ||
| 39 | 97607 |
public Query rewrite(IndexReader reader) throws IOException { |
| 40 | 97607 | return this; |
| 41 | } | |
| 42 | ||
| 43 | 0 |
public void extractTerms(Set terms) { |
| 44 | // OK to not add any terms when used for MultiSearcher, | |
| 45 | // but may not be OK for highlighting | |
| 46 | } | |
| 47 | ||
| 48 | protected class ConstantWeight implements Weight { | |
| 49 | private Similarity similarity; | |
| 50 | private float queryNorm; | |
| 51 | private float queryWeight; | |
| 52 | ||
| 53 | 97607 |
public ConstantWeight(Searcher searcher) { |
| 54 | 97607 | this.similarity = getSimilarity(searcher); |
| 55 | } | |
| 56 | ||
| 57 | 0 |
public Query getQuery() { |
| 58 | 0 | return ConstantScoreQuery.this; |
| 59 | } | |
| 60 | ||
| 61 | 97607 |
public float getValue() { |
| 62 | 97607 | return queryWeight; |
| 63 | } | |
| 64 | ||
| 65 | 97607 |
public float sumOfSquaredWeights() throws IOException { |
| 66 | 97607 | queryWeight = getBoost(); |
| 67 | 97607 | return queryWeight * queryWeight; |
| 68 | } | |
| 69 | ||
| 70 | 97607 |
public void normalize(float norm) { |
| 71 | 97607 | this.queryNorm = norm; |
| 72 | 97607 | queryWeight *= this.queryNorm; |
| 73 | } | |
| 74 | ||
| 75 | 97607 |
public Scorer scorer(IndexReader reader) throws IOException { |
| 76 | ||