Search in sources :

Example 1 with LindenDisMaxQuery

use of com.xiaomi.linden.thrift.common.LindenDisMaxQuery in project linden by XiaoMi.

the class DisMaxQueryConstructor method construct.

@Override
protected Query construct(LindenQuery lindenQuery, LindenConfig config) throws Exception {
    if (!lindenQuery.isSetDisMaxQuery()) {
        return null;
    }
    LindenDisMaxQuery disMaxQuery = lindenQuery.getDisMaxQuery();
    DisjunctionMaxQuery disjunctionMaxQuery = new DisjunctionMaxQuery((float) disMaxQuery.getTie());
    for (LindenQuery subLindenQuery : disMaxQuery.getQueries()) {
        Query query = QueryConstructor.constructQuery(subLindenQuery, config);
        if (query != null) {
            disjunctionMaxQuery.add(query);
        }
    }
    return disjunctionMaxQuery;
}
Also used : LindenQuery(com.xiaomi.linden.thrift.common.LindenQuery) Query(org.apache.lucene.search.Query) LindenQuery(com.xiaomi.linden.thrift.common.LindenQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) LindenDisMaxQuery(com.xiaomi.linden.thrift.common.LindenDisMaxQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) LindenDisMaxQuery(com.xiaomi.linden.thrift.common.LindenDisMaxQuery)

Aggregations

LindenDisMaxQuery (com.xiaomi.linden.thrift.common.LindenDisMaxQuery)1 LindenQuery (com.xiaomi.linden.thrift.common.LindenQuery)1 DisjunctionMaxQuery (org.apache.lucene.search.DisjunctionMaxQuery)1 Query (org.apache.lucene.search.Query)1