static TestQueryParser*
logical_test_simple_term(u32_t boolop)
{
    Query   *tree   = make_leaf_query(NULL, "b");
    UNUSED_VAR(boolop);
    return TestQP_new("b", tree, NULL, 3);
}
static TestQueryParser*
logical_test_one_nested_term(u32_t boolop)
{
    Query   *leaf   = make_leaf_query(NULL, "a");
    Query   *tree   = make_poly_query(boolop, leaf, NULL);
    return TestQP_new("(a)", tree, NULL, 4);
}
static TestQueryParser*
logical_test_nested_empty_phrase(u32_t boolop)
{
    Query   *leaf   = make_leaf_query(NULL, "\"\"");
    Query   *tree   = make_poly_query(boolop, leaf, NULL);
    return TestQP_new("(\"\")", tree, NULL, 0);
}
static TestQueryParser*
prune_test_nomatch()
{
    Query   *tree   = (Query*)NoMatchQuery_new();
    Query   *pruned = (Query*)NoMatchQuery_new();
    return TestQP_new(NULL, tree, pruned, 0);
}
static TestQueryParser*
logical_test_nested_empty_parens(u32_t boolop)
{
    Query   *inner   = make_poly_query(boolop, NULL);
    Query   *tree    = make_poly_query(boolop, inner, NULL);
    return TestQP_new("(())", tree, NULL, 0);
}
static TestQueryParser*
logical_test_one_term_phrase(u32_t boolop)
{
    Query   *tree   = make_leaf_query(NULL, "\"a\"");
    UNUSED_VAR(boolop);
    return TestQP_new("\"a\"", tree, NULL, 4);
}
Ejemplo n.º 7
0
static TestQueryParser*
syntax_test_padded_minus() {
    Query *minus = make_leaf_query(NULL, "-");
    Query *a = make_leaf_query(NULL, "a");
    Query *tree = make_poly_query(BOOLOP_OR, minus, a, NULL);
    return TestQP_new("- a", tree, NULL, 4);
}
Ejemplo n.º 8
0
static TestQueryParser*
syntax_test_minus_minus()
{
    // Not a perfect result, but then it's not a good query string. 
    Query *tree = make_leaf_query(NULL, "a");
    return TestQP_new("--a", tree, NULL, 4);
}
Ejemplo n.º 9
0
static TestQueryParser*
logical_test_pure_negation(uint32_t boolop) {
    Query   *leaf   = make_leaf_query(NULL, "x");
    Query   *tree   = make_not_query(leaf);
    UNUSED_VAR(boolop);
    return TestQP_new("-x", tree, NULL, 0);
}
static TestQueryParser*
logical_test_double_negative(u32_t boolop)
{
    Query   *tree   = make_leaf_query(NULL, "a");
    UNUSED_VAR(boolop);
    return TestQP_new("--a", tree, NULL, 4);
}
Ejemplo n.º 11
0
static TestQueryParser*
leaf_test_unrecognized_field()
{
    Query *tree     = make_leaf_query("bogusfield", "b");
    Query *expanded = make_term_query("bogusfield", "b");
    return TestQP_new("bogusfield:b", tree, expanded, 0);
}
Ejemplo n.º 12
0
static TestQueryParser*
logical_test_triple_negative(uint32_t boolop) {
    Query   *leaf   = make_leaf_query(NULL, "a");
    Query   *tree   = make_not_query(leaf);
    UNUSED_VAR(boolop);
    return TestQP_new("---a", tree, NULL, 0);
}
Ejemplo n.º 13
0
static TestQueryParser*
leaf_test_field()
{
    Query *tree     = make_leaf_query("plain", "b");
    Query *expanded = make_term_query("plain", "b");
    return TestQP_new("plain:b", tree, expanded, 3);
}
Ejemplo n.º 14
0
static TestQueryParser*
syntax_test_unclosed_parens() {
    // Not a perfect result, but then it's not a good query string.
    Query *inner = make_poly_query(BOOLOP_OR, NULL);
    Query *tree = make_poly_query(BOOLOP_OR, inner, NULL);
    return TestQP_new("((", tree, NULL, 0);
}
Ejemplo n.º 15
0
static TestQueryParser*
syntax_test_minus_plus()
{
    Query *leaf = make_leaf_query(NULL, "a");
    Query *tree = make_not_query(leaf);
    return TestQP_new("-+a", tree, NULL, 0);
}
Ejemplo n.º 16
0
static TestQueryParser*
leaf_test_unescape_colons()
{
    Query *tree     = make_leaf_query("plain", "a\\:b");
    Query *expanded = make_term_query("plain", "a:b");
    return TestQP_new("plain:a\\:b", tree, expanded, 0);
}
static TestQueryParser*
logical_test_field_phrase(u32_t boolop)
{
    Query   *tree = make_leaf_query("content", "\"b c\"");
    UNUSED_VAR(boolop);
    return TestQP_new("content:\"b c\"", tree, NULL, 2);
}
Ejemplo n.º 18
0
static TestQueryParser*
syntax_test_not_plus() {
    // Not a perfect result, but then it's not a good query string.
    Query *leaf = make_leaf_query(NULL, "a");
    Query *tree = make_not_query(leaf);
    return TestQP_new("NOT +a", tree, NULL, 0);
}
Ejemplo n.º 19
0
static TestQueryParser*
logical_test_one_term_one_phrase(uint32_t boolop) {
    Query   *a_leaf   = make_leaf_query(NULL, "a");
    Query   *bc_leaf  = make_leaf_query(NULL, "\"b c\"");
    Query   *tree     = make_poly_query(boolop, a_leaf, bc_leaf, NULL);
    uint32_t num_hits = boolop == BOOLOP_OR ? 4 : 2;
    return TestQP_new("a \"b c\"", tree, NULL, num_hits);
}
Ejemplo n.º 20
0
static TestQueryParser*
logical_test_field_bool_group(uint32_t boolop) {
    Query   *b_query = make_leaf_query("content", "b");
    Query   *c_query = make_leaf_query("content", "c");
    Query   *tree    = make_poly_query(boolop, b_query, c_query, NULL);
    return TestQP_new("content:(b c)", tree, NULL,
                      boolop == BOOLOP_OR ? 3 : 2);
}
Ejemplo n.º 21
0
static TestQueryParser*
logical_test_a_or_plus_b(uint32_t boolop) {
    Query   *a_query = make_leaf_query(NULL, "a");
    Query   *b_query = make_leaf_query(NULL, "b");
    Query   *tree    = make_poly_query(BOOLOP_OR, a_query, b_query, NULL);
    UNUSED_VAR(boolop);
    return TestQP_new("a OR +b", tree, NULL, 4);
}
Ejemplo n.º 22
0
static TestQueryParser*
logical_test_intersection(uint32_t boolop) {
    Query   *a_query = make_leaf_query(NULL, "a");
    Query   *b_query = make_leaf_query(NULL, "b");
    Query   *tree    = make_poly_query(BOOLOP_AND, a_query, b_query, NULL);
    UNUSED_VAR(boolop);
    return TestQP_new("a AND b", tree, NULL, 3);
}
Ejemplo n.º 23
0
static TestQueryParser*
leaf_test_empty_phrase() {
    Query   *tree     = make_leaf_query(NULL, "\"\"");
    Query   *plain_q  = make_phrase_query("plain", NULL);
    Query   *fancy_q  = make_phrase_query("fancy", NULL);
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("\"\"", tree, expanded, 0);
}
Ejemplo n.º 24
0
static TestQueryParser*
leaf_test_unclosed_quote() {
    Query   *tree     = make_leaf_query(NULL, "\"a b");
    Query   *plain_q  = make_phrase_query("plain", "a", "b", NULL);
    Query   *fancy_q  = make_phrase_query("fancy", "a", "b", NULL);
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("\"a b", tree, expanded, 3);
}
Ejemplo n.º 25
0
static TestQueryParser*
logical_test_two_terms_nested(uint32_t boolop) {
    Query   *a_leaf     = make_leaf_query(NULL, "a");
    Query   *b_leaf     = make_leaf_query(NULL, "b");
    Query   *tree       = make_poly_query(boolop, a_leaf, b_leaf, NULL);
    uint32_t num_hits   = boolop == BOOLOP_OR ? 4 : 3;
    return TestQP_new("(a b)", tree, NULL, num_hits);
}
Ejemplo n.º 26
0
static TestQueryParser*
leaf_test_different_tokenization() {
    Query   *tree     = make_leaf_query(NULL, "a.b");
    Query   *plain_q  = make_term_query("plain", "a.b");
    Query   *fancy_q  = make_phrase_query("fancy", "a", "b", NULL);
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("a.b", tree, expanded, 3);
}
Ejemplo n.º 27
0
static TestQueryParser*
leaf_test_phrase_with_stopwords() {
    Query   *tree     = make_leaf_query(NULL, "\"x a\"");
    Query   *plain_q  = make_phrase_query("plain", "x", "a", NULL);
    Query   *fancy_q  = make_phrase_query("fancy", "a", NULL);
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("\"x a\"", tree, expanded, 4);
}
Ejemplo n.º 28
0
static TestQueryParser*
leaf_test_simple_term() {
    Query   *tree     = make_leaf_query(NULL, "a");
    Query   *plain_q  = make_term_query("plain", "a");
    Query   *fancy_q  = make_term_query("fancy", "a");
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("a", tree, expanded, 4);
}
Ejemplo n.º 29
0
static TestQueryParser*
leaf_test_escaped_quotes_outside() {
    Query   *tree = make_leaf_query(NULL, "\\\"a");
    Query   *plain_q  = make_term_query("plain", "\"a");
    Query   *fancy_q  = make_term_query("fancy", "a");
    Query   *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
    return TestQP_new("\\\"a", tree, expanded, 4);
}
Ejemplo n.º 30
0
static TestQueryParser*
logical_test_field_multi_OR(uint32_t boolop) {
    Query *a_query = make_leaf_query("content", "a");
    Query *b_query = make_leaf_query("content", "b");
    Query *c_query = make_leaf_query("content", "c");
    Query *tree = make_poly_query(BOOLOP_OR, a_query, b_query, c_query, NULL);
    UNUSED_VAR(boolop);
    return TestQP_new("content:(a OR b OR c)", tree, NULL, 4);
}