Example usage for org.apache.solr.search SolrConstantScoreQuery setCache

List of usage examples for org.apache.solr.search SolrConstantScoreQuery setCache

Introduction

In this page you can find the example usage for org.apache.solr.search SolrConstantScoreQuery setCache.

Prototype

@Override
    public void setCache(boolean cache) 

Source Link

Usage

From source file:com.ifactory.press.db.solr.search.ScoringParentQParser.java

License:Apache License

@Override
public Query parse() throws SyntaxError {
    if (localParams == null) {
        throw new SyntaxError("join query parser must be invoked using localParams");
    }/*from   w  ww .  j av a 2 s . com*/
    String filter = localParams.get(getParentFilterLocalParamName());
    QParser parentParser = subQuery(filter, null);
    Query parentQ = parentParser.getQuery();

    String queryText = localParams.get(QueryParsing.V);
    // there is no child query, return parent filter from cache
    if (queryText == null || queryText.length() == 0) {
        SolrConstantScoreQuery wrapped = new SolrConstantScoreQuery(getFilter(parentQ));
        wrapped.setCache(false);
        return wrapped;
    }
    QParser childrenParser = subQuery(queryText, null);
    Query childrenQuery = childrenParser.getQuery();
    return createQuery(parentQ, childrenQuery);
}