Package org.apache.lucene.queryparser.flexible.core.nodes

Examples of org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode


  public SlopQueryNodeBuilder() {
  // empty constructor
  }

  public NodePhraseQuery build(QueryNode queryNode) throws QueryNodeException {
    final SlopQueryNode phraseSlopNode = (SlopQueryNode) queryNode;

    if (phraseSlopNode.getValue() != 0)
      throw new NotImplementedException("Slop Queries not supported in Siren yet");

    return (NodePhraseQuery) phraseSlopNode.getChild().getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);

    // TODO: To implement when siren will support slop queries
    // SlopQueryNode phraseSlopNode = (SlopQueryNode) queryNode;
    //
    // Query query = (Query) phraseSlopNode.getChild().getTag(
View Full Code Here


         int phraseSlop = 0;

         if (fuzzySlop != null) {
           try {
             phraseSlop = Float.valueOf(fuzzySlop.image.substring(1)).intValue();
             q = new SlopQueryNode(q, phraseSlop);
           }
           catch (Exception ignored) {
            /* Should this be handled somehow? (defaults to "no PhraseSlop", if
           * slop number is invalid)
           */
 
View Full Code Here

         int phraseSlop = 0;

         if (fuzzySlop != null) {
           try {
             phraseSlop = Float.valueOf(fuzzySlop.image.substring(1)).intValue();
             q = new SlopQueryNode(q, phraseSlop);
           }
           catch (Exception ignored) {
            /* Should this be handled somehow? (defaults to "no PhraseSlop", if
           * slop number is invalid)
           */
 
View Full Code Here

    // empty constructor
  }

  @Override
  public Query build(QueryNode queryNode) throws QueryNodeException {
    SlopQueryNode phraseSlopNode = (SlopQueryNode) queryNode;

    Query query = (Query) phraseSlopNode.getChild().getTag(
        QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);

    if (query instanceof PhraseQuery) {
      ((PhraseQuery) query).setSlop(phraseSlopNode.getValue());

    } else {
      ((MultiPhraseQuery) query).setSlop(phraseSlopNode.getValue());
    }

    return query;

  }
View Full Code Here

  protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {

    if (node instanceof TokenizedPhraseQueryNode
        || node instanceof MultiPhraseQueryNode) {

      return new SlopQueryNode(node, this.defaultPhraseSlop);

    }

    return node;
View Full Code Here

  @Override
  protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {

    if (node instanceof SlopQueryNode) {
      SlopQueryNode phraseSlopNode = (SlopQueryNode) node;

      if (!(phraseSlopNode.getChild() instanceof TokenizedPhraseQueryNode)
          && !(phraseSlopNode.getChild() instanceof MultiPhraseQueryNode)) {
        return phraseSlopNode.getChild();
      }

    }

    return node;
View Full Code Here

         int phraseSlop = 0;

         if (fuzzySlop != null) {
           try {
             phraseSlop = Float.valueOf(fuzzySlop.image.substring(1)).intValue();
             q = new SlopQueryNode(q, phraseSlop);
           }
           catch (Exception ignored) {
            /* Should this be handled somehow? (defaults to "no PhraseSlop", if
           * slop number is invalid)
           */
 
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.