aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java
blob: e3b2278475b21df032bd8cc4907391fed34d2956 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query.parser;

import com.yahoo.language.Language;
import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.query.Item;
import com.yahoo.search.query.parser.Parser;

import java.util.Collections;
import java.util.Set;

/**
 * @author Simon Thoresen Hult
 */
public interface CustomParser extends Parser {

    /**
     * Returns the raw result from parsing, <i>not</i> wrapped in a QueryTree
     * instance. This may also be null, as opposed to using
     * {@link Parser#parse(com.yahoo.search.query.parser.Parsable)}.
     */
    default Item parse(String queryToParse, String filterToParse, Language parsingLanguage,
                       Set<String> toSearch, IndexFacts indexFacts, String defaultIndexName) {
        if (indexFacts == null)
            indexFacts = new IndexFacts();
        return parse(queryToParse, filterToParse, parsingLanguage, indexFacts.newSession(toSearch, Collections.emptySet()), defaultIndexName);
    }

    Item parse(String queryToParse, String filterToParse, Language parsingLanguage,
               IndexFacts.Session indexFacts, String defaultIndexName);

}