本文整理汇总了Java中org.apache.lucene.queries.ChainedFilter.AND属性的典型用法代码示例。如果您正苦于以下问题:Java ChainedFilter.AND属性的具体用法?Java ChainedFilter.AND怎么用?Java ChainedFilter.AND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.lucene.queries.ChainedFilter
的用法示例。
在下文中一共展示了ChainedFilter.AND属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 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);
}
示例2: testAND
public void testAND() throws Exception {
ChainedFilter chain = new ChainedFilter(new Filter[] { dateFilter, bobFilter }, ChainedFilter.AND);
TopDocs hits = searcher.search(query, chain, 10);
assertEquals("AND matches just Bob", MAX / 2, hits.totalHits);
StoredDocument firstDoc = searcher.doc(hits.scoreDocs[0].doc);
assertEquals("bob", firstDoc.get("owner"));
}
示例3: testANDNOT
public void testANDNOT() throws Exception {
ChainedFilter chain = new ChainedFilter(new Filter[] { dateFilter, sueFilter }, new int[] { ChainedFilter.AND,
ChainedFilter.ANDNOT });
TopDocs hits = searcher.search(query, chain, 10);
assertEquals("ANDNOT matches just Bob", MAX / 2, hits.totalHits);
StoredDocument firstDoc = searcher.doc(hits.scoreDocs[0].doc);
assertEquals("bob", firstDoc.get("owner"));
}