Search in sources :

Example 1 with ContextAwareQuery

use of org.alfresco.solr.ContextAwareQuery in project SearchServices by Alfresco.

the class PostFilterQuery method getPostFilters.

private void getPostFilters(Query q, List<PostFilter> postFilters) {
    if (q instanceof BooleanQuery) {
        BooleanQuery bq = (BooleanQuery) q;
        List<BooleanClause> clauses = bq.clauses();
        for (BooleanClause clause : clauses) {
            Query q1 = clause.getQuery();
            getPostFilters(q1, postFilters);
        }
    } else if (q instanceof ContextAwareQuery) {
        ContextAwareQuery cq = (ContextAwareQuery) q;
        getPostFilters(cq.getLuceneQuery(), postFilters);
    } else if (q instanceof PostFilter) {
        postFilters.add((PostFilter) q);
    } else if (q instanceof BoostQuery) {
        BoostQuery bq = (BoostQuery) q;
        getPostFilters(bq.getQuery(), postFilters);
    }
}
Also used : BooleanClause(org.apache.lucene.search.BooleanClause) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) BooleanQuery(org.apache.lucene.search.BooleanQuery) BoostQuery(org.apache.lucene.search.BoostQuery) ContextAwareQuery(org.alfresco.solr.ContextAwareQuery) BoostQuery(org.apache.lucene.search.BoostQuery) ContextAwareQuery(org.alfresco.solr.ContextAwareQuery) PostFilter(org.apache.solr.search.PostFilter)

Aggregations

ContextAwareQuery (org.alfresco.solr.ContextAwareQuery)1 BooleanClause (org.apache.lucene.search.BooleanClause)1 BooleanQuery (org.apache.lucene.search.BooleanQuery)1 BoostQuery (org.apache.lucene.search.BoostQuery)1 Query (org.apache.lucene.search.Query)1 PostFilter (org.apache.solr.search.PostFilter)1