mirror of https://github.com/apache/lucene.git
Added toString implementation on BooleanFilter.java, provided by Jason Calabrese
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@595996 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e35a66d8a3
commit
04ae927f38
|
@ -178,4 +178,43 @@ public class BooleanFilter extends Filter
|
|||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/** Prints a user-readable version of this query. */
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append("BooleanFilter(");
|
||||
|
||||
appendFilters(shouldFilters, null, buffer);
|
||||
appendFilters(mustFilters, "+", buffer);
|
||||
appendFilters(notFilters, "-", buffer);
|
||||
|
||||
buffer.append(")");
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
private void appendFilters(ArrayList filters, String occurString,
|
||||
StringBuffer buffer)
|
||||
{
|
||||
if (filters == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < filters.size(); i++)
|
||||
{
|
||||
Filter filter = (Filter) filters.get(i);
|
||||
if (occurString != null)
|
||||
{
|
||||
buffer.append(occurString);
|
||||
}
|
||||
|
||||
buffer.append(filter);
|
||||
|
||||
if (i < filters.size() - 1)
|
||||
{
|
||||
buffer.append(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue