Пример #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));
  }
Пример #2
0
  @Test
  public void allNestedDisjunctionClausesAreIncluded() throws Exception {

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

    assertThat(treeBuilder.collectTerms(q)).hasSize(3);
  }
Пример #3
0
  @Test
  public void allDisjunctionClausesOfAConjunctionAreExtracted() throws Exception {

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

    assertThat(treeBuilder.collectTerms(q)).hasSize(2);
  }
Пример #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));
  }
Пример #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));
  }