* @throws IOException if an error occurs while reading from the index.
*/
@Override
public Query rewrite(IndexReader reader) throws IOException
{
Query stdWildcardQuery = new MultiTermQuery()
{
@Override
protected FilteredTermEnum getEnum(IndexReader reader) throws IOException
{
return new WildcardTermEnum(reader, field, propName, pattern, transform);
}
/** Prints a user-readable version of this query. */
@Override
public String toString(String field)
{
StringBuffer buffer = new StringBuffer();
buffer.append(field);
buffer.append(':');
buffer.append(ToStringUtils.boost(getBoost()));
return buffer.toString();
}
};
try
{
multiTermQuery = stdWildcardQuery.rewrite(reader);
return multiTermQuery;
}
catch (BooleanQuery.TooManyClauses e)
{
// MultiTermQuery not possible