Example usage for org.apache.lucene.queryparser.flexible.core.nodes FuzzyQueryNode setPrefixLength

List of usage examples for org.apache.lucene.queryparser.flexible.core.nodes FuzzyQueryNode setPrefixLength

Introduction

In this page you can find the example usage for org.apache.lucene.queryparser.flexible.core.nodes FuzzyQueryNode setPrefixLength.

Prototype

public void setPrefixLength(int prefixLength) 

Source Link

Usage

From source file:com.sindicetech.siren.qparser.keyword.builders.concise.ConciseNodeFuzzyQueryNodeBuilder.java

License:Open Source License

@Override
public NodeQuery build(final QueryNode queryNode) throws QueryNodeException {
    if (conf.has(ConciseKeywordQueryConfigHandler.ConciseKeywordConfigurationKeys.ATTRIBUTE)) {
        final String attribute = conf
                .get(ConciseKeywordQueryConfigHandler.ConciseKeywordConfigurationKeys.ATTRIBUTE);

        FuzzyQueryNode fuzzyNode = (FuzzyQueryNode) queryNode;

        // Prepend the attribute to the query term
        ConciseNodeBuilderUtil.prepend(builder, attribute, fuzzyNode);

        // Update the prefix length: must account for the attribute length plus the delimiter character
        fuzzyNode.setPrefixLength(fuzzyNode.getPrefixLength() + attribute.length() + 1);
    }/*ww w.  j  a  va  2  s . co m*/

    // Delegate the build to parent class
    return super.build(queryNode);
}