Fixed minor problems with previous checkin.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2003-01-14 00:04:37 +00:00
parent 169fac073f
commit bdc8da1823
5 changed files with 13 additions and 11 deletions

View File

@ -173,7 +173,7 @@ public class BooleanQuery extends Query {
/** Prints a user-readable version of this query. */
public String toString(String field) {
StringBuffer buffer = new StringBuffer();
if (getBoost() > 1.0) {
if (getBoost() != 1.0) {
buffer.append("(");
}
@ -196,7 +196,7 @@ public class BooleanQuery extends Query {
buffer.append(" ");
}
if (getBoost() > 1.0) {
if (getBoost() != 1.0) {
buffer.append(")^");
buffer.append(getBoost());
}

View File

@ -93,8 +93,8 @@ public final class Hits {
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
float scoreNorm = 1.0f;
// if (length > 0 && scoreDocs[0].score > 1.0f)
// scoreNorm = 1.0f / scoreDocs[0].score;
if (length > 0 && scoreDocs[0].score > 1.0f)
scoreNorm = 1.0f / scoreDocs[0].score;
int end = scoreDocs.length < length ? scoreDocs.length : length;
for (int i = hitDocs.size(); i < end; i++)

View File

@ -187,7 +187,6 @@ public class IndexSearcher extends Searcher implements Searchable {
scorer.score(collector, reader.maxDoc());
}
/** */
public Query rewrite(Query original) throws IOException {
Query query = original;
for (Query rewrittenQuery = query.rewrite(reader); rewrittenQuery != query;
@ -197,7 +196,6 @@ public class IndexSearcher extends Searcher implements Searchable {
return query;
}
/** */
public Explanation explain(Query query, int doc) throws IOException {
return query.weight(this).scorer(reader).explain(doc);
}

View File

@ -204,7 +204,6 @@ public class MultiSearcher extends Searcher implements Searchable {
}
}
/** */
public Query rewrite(Query original) throws IOException {
Query[] queries = new Query[searchables.length];
for (int i = 0; i < searchables.length; i++) {
@ -213,8 +212,6 @@ public class MultiSearcher extends Searcher implements Searchable {
return original.combine(queries);
}
/** */
public Explanation explain(Query query, int doc) throws IOException {
int i = subSearcher(doc); // find searcher index
return searchables[i].explain(query,doc-starts[i]); // dispatch to searcher

View File

@ -113,10 +113,17 @@ public interface Searchable extends java.rmi.Remote {
*/
Document doc(int i) throws IOException;
/** */
/** Expert: called to re-write queries into primitive queries. */
Query rewrite(Query query) throws IOException;
/** */
/** Returns an Explanation that describes how <code>doc</code> scored against
* <code>query</code>.
*
* <p>This is intended to be used in developing Similarity implementations,
* and, for good performance, should not be displayed with every hit.
* Computing an explanation is as expensive as executing the query over the
* entire index.
*/
Explanation explain(Query query, int doc) throws IOException;