Added a few accessors.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150213 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2004-02-25 22:29:18 +00:00
parent 3f3c0aa917
commit de9099fb72
2 changed files with 17 additions and 3 deletions

View File

@ -69,6 +69,9 @@ public class PrefixQuery extends Query {
this.prefix = prefix;
}
/** Returns the prefix of this query. */
public Term getPrefix() { return prefix; }
public Query rewrite(IndexReader reader) throws IOException {
BooleanQuery query = new BooleanQuery();
TermEnum enumerator = reader.terms(prefix);
@ -113,4 +116,5 @@ public class PrefixQuery extends Query {
}
return buffer.toString();
}
}

View File

@ -153,11 +153,21 @@ public class RangeQuery extends Query
return Query.mergeBooleanQueries(queries);
}
private String getField()
{
/** Returns the field name for this query */
public String getField() {
return (lowerTerm != null ? lowerTerm.field() : upperTerm.field());
}
/** Returns the lower term of this range query */
public Term getLowerTerm() { return lowerTerm; }
/** Returns the upper term of this range query */
public Term getUpperTerm() { return upperTerm; }
/** Returns <code>true</code> if the range query is inclusive */
public boolean isInclusive() { return inclusive; }
/** Prints a user-readable version of this query. */
public String toString(String field)
{