use of org.apache.solr.search.SolrConstantScoreQuery in project lucene-solr by apache.
the class CurrencyValue method getRangeQuery.
public Query getRangeQuery(QParser parser, SchemaField field, final CurrencyValue p1, final CurrencyValue p2, final boolean minInclusive, final boolean maxInclusive) {
String currencyCode = (p1 != null) ? p1.getCurrencyCode() : (p2 != null) ? p2.getCurrencyCode() : defaultCurrency;
// ValueSourceRangeFilter doesn't check exists(), so we have to
final Filter docsWithValues = new QueryWrapperFilter(new FieldValueQuery(getAmountField(field).getName()));
final Filter vsRangeFilter = new ValueSourceRangeFilter(new RawCurrencyValueSource(field, currencyCode, parser), p1 == null ? null : p1.getAmount() + "", p2 == null ? null : p2.getAmount() + "", minInclusive, maxInclusive);
final BooleanQuery.Builder docsInRange = new BooleanQuery.Builder();
docsInRange.add(docsWithValues, Occur.FILTER);
docsInRange.add(vsRangeFilter, Occur.FILTER);
return new SolrConstantScoreQuery(new QueryWrapperFilter(docsInRange.build()));
}
use of org.apache.solr.search.SolrConstantScoreQuery in project lucene-solr by apache.
the class BlockJoinParentQParser method parse.
@Override
public Query parse() throws SyntaxError {
String filter = localParams.get(getParentFilterLocalParamName());
String scoreMode = localParams.get("score", ScoreMode.None.name());
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, scoreMode);
}
Aggregations