Package org.sindice.siren.search.node

Examples of org.sindice.siren.search.node.NodeTermRangeQuery


  }

  @Test
  public void testRangeQueries()
  throws Exception {
    NodeQuery q = new NodeTermRangeQuery(SirenTestCase.DEFAULT_TEST_FIELD,
      new BytesRef("a"), new BytesRef("b"), true, true);
    this._assertSirenQuery(new LuceneProxyNodeQuery(q), "[ a TO b ]");

    q = new NodeTermRangeQuery(SirenTestCase.DEFAULT_TEST_FIELD,
      new BytesRef("a"), new BytesRef("b"), false, true);
    this._assertSirenQuery(new LuceneProxyNodeQuery(q), "{ a TO b ]");

    q = new NodeTermRangeQuery(SirenTestCase.DEFAULT_TEST_FIELD,
      new BytesRef("a"), new BytesRef("b"), true, false);
    this._assertSirenQuery(new LuceneProxyNodeQuery(q), "[ a TO b }");

    q = new NodeTermRangeQuery(SirenTestCase.DEFAULT_TEST_FIELD,
      new BytesRef("a"), new BytesRef("b"), false, false);
    this._assertSirenQuery(new LuceneProxyNodeQuery(q), "{ a TO b }");

    final TwigQuery twq1 = new TwigQuery(1);
    twq1.addChild(q, NodeBooleanClause.Occur.MUST);
    // TODO parsing the output of #toString of twq1 is not possible because of GH-52
    assertEquals(new LuceneProxyNodeQuery(twq1), this.parse(null, "* : { a TO b }"));

    final TwigQuery twq2 = new TwigQuery(1);
    twq2.addChild(new NodeTermRangeQuery(SirenTestCase.DEFAULT_TEST_FIELD,
      new BytesRef("a"), new BytesRef("b"), true, true), NodeBooleanClause.Occur.MUST);
    twq2.addChild(q, NodeBooleanClause.Occur.MUST);
    assertEquals(new LuceneProxyNodeQuery(twq2), this.parse(null, "* : [ [ a TO b ], { a TO b } ]"));
  }
View Full Code Here


    if (upperText.length() == 0) {
      upperText = null;
    }

    final NodeTermRangeQuery rangeQuery = NodeTermRangeQuery.newStringRange(field, lowerText, upperText, rangeNode
        .isLowerInclusive(), rangeNode.isUpperInclusive());

    final MultiNodeTermQuery.RewriteMethod method = (MultiNodeTermQuery.RewriteMethod) queryNode
        .getTag(MultiNodeTermRewriteMethodProcessor.TAG_ID);
    if (method != null) {
      rangeQuery.setRewriteMethod(method);
    }
    return rangeQuery;
  }
View Full Code Here

TOP

Related Classes of org.sindice.siren.search.node.NodeTermRangeQuery

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.