Example usage for org.apache.lucene.queryparser.flexible.standard.nodes RegexpQueryNode textToBytesRef

List of usage examples for org.apache.lucene.queryparser.flexible.standard.nodes RegexpQueryNode textToBytesRef

Introduction

In this page you can find the example usage for org.apache.lucene.queryparser.flexible.standard.nodes RegexpQueryNode textToBytesRef.

Prototype

public BytesRef textToBytesRef() 

Source Link

Usage

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

License:Open Source License

public NodeQuery build(final QueryNode queryNode) throws QueryNodeException {
    final RegexpQueryNode regexpNode = (RegexpQueryNode) queryNode;

    final NodeRegexpQuery q = new NodeRegexpQuery(
            new Term(regexpNode.getFieldAsString(), regexpNode.textToBytesRef()));
    // assign the datatype. We must always have a datatype assigned.
    q.setDatatype((String) queryNode.getTag(DatatypeQueryNode.DATATYPE_TAGID));

    final MultiNodeTermQuery.RewriteMethod method = (MultiNodeTermQuery.RewriteMethod) queryNode
            .getTag(MultiNodeTermRewriteMethodProcessor.TAG_ID);

    if (method != null) {
        q.setRewriteMethod(method);/*from ww w.  j a v a  2s .c om*/
    }

    // if it is tagged as a span query
    if (regexpNode.getTag(QueryTypeProcessor.QUERYTYPE_TAG) == QueryTypeProcessor.SPAN_QUERYTYPE) {
        return new MultiTermSpanQuery<>(q);
    } else {
        return q;
    }
}

From source file:org.sindice.siren.qparser.keyword.builders.NodeRegexpQueryNodeBuilder.java

License:Apache License

public NodeQuery build(final QueryNode queryNode) throws QueryNodeException {
    final RegexpQueryNode regexpNode = (RegexpQueryNode) queryNode;

    final NodeRegexpQuery q = new NodeRegexpQuery(
            new Term(regexpNode.getFieldAsString(), regexpNode.textToBytesRef()));

    final MultiNodeTermQuery.RewriteMethod method = (MultiNodeTermQuery.RewriteMethod) queryNode
            .getTag(MultiNodeTermRewriteMethodProcessor.TAG_ID);
    if (method != null) {
        q.setRewriteMethod(method);//from   w ww  .  ja  va 2 s  .  co m
    }
    return q;
}