Ejemplo n.º 1
0
  @Test
  public void conjunctionsOutweighDisjunctions() throws Exception {
    Query bq = ParserUtils.parse("field1:term1 +field1:term2");

    assertThat(treeBuilder.collectTerms(bq))
        .containsOnly(new QueryTerm("field1", "term2", QueryTerm.Type.EXACT));
  }
Ejemplo n.º 2
0
  @Test
  public void allNestedDisjunctionClausesAreIncluded() throws Exception {

    Query q = ParserUtils.parse("field1:term3 (field1:term1 field1:term2)");

    assertThat(treeBuilder.collectTerms(q)).hasSize(3);
  }
Ejemplo n.º 3
0
  @Test
  public void allDisjunctionClausesOfAConjunctionAreExtracted() throws Exception {

    Query q = ParserUtils.parse("+(field1:term1 field1:term2) field1:term3");

    assertThat(treeBuilder.collectTerms(q)).hasSize(2);
  }
Ejemplo n.º 4
0
  @Test
  public void disjunctionsWithMatchAllNegativeClausesReturnANYTOKEN() throws Exception {

    Query q = ParserUtils.parse("+field1:term1 +(field2:term22 (*:* -field2:notterm))");

    assertThat(treeBuilder.collectTerms(q))
        .containsOnly(new QueryTerm("field1", "term1", QueryTerm.Type.EXACT));
  }
Ejemplo n.º 5
0
  @Test
  public void allDisjunctionQueriesAreIncluded() throws Exception {

    Query bq = ParserUtils.parse("field1:term1 field1:term2");
    List<QueryTerm> terms = treeBuilder.collectTerms(bq);

    assertThat(terms)
        .containsOnly(
            new QueryTerm("field1", "term1", QueryTerm.Type.EXACT),
            new QueryTerm("field1", "term2", QueryTerm.Type.EXACT));
  }