summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/querytransform/QueryTreeUtil.java
blob: 1cf6396468edb52cc881815797bb4fd3f3c07967 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.querytransform;

import com.yahoo.prelude.query.AndItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.QueryCanonicalizer;
import com.yahoo.search.Query;
import com.yahoo.search.query.QueryTree;

/**
 * Utility class for manipulating a QueryTree.
 *
 * @author geirst
 * @deprecated use QueryTree.and instead // TODO: Remove on Vespa 8
 */
@Deprecated
public class QueryTreeUtil {

    /**
     * Adds the given item to this query
     *
     * @return the new root of the query tree
     */
    static public Item andQueryItemWithRoot(Query query, Item item) {
        return andQueryItemWithRoot(query.getModel().getQueryTree(), item);
    }

    /**
     * Adds the given item to this query
     *
     * @return the new root of the query tree
     */
    static public Item andQueryItemWithRoot(QueryTree tree, Item item) {
        return tree.and(item);
    }

}