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 FieldValueFilter(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 Filter docsInRange = new ChainedFilter (new Filter [] { docsWithValues, vsRangeFilter }, ChainedFilter.AND); return new SolrConstantScoreQuery(docsInRange); }
private Query toDoesNotExistQuery(SearchQuery.Exists exists) { return new FieldValueFilter(exists.getField(), true); }