本文整理汇总了Java中org.apache.solr.util.SolrPluginUtils.flattenBooleanQuery方法的典型用法代码示例。如果您正苦于以下问题:Java SolrPluginUtils.flattenBooleanQuery方法的具体用法?Java SolrPluginUtils.flattenBooleanQuery怎么用?Java SolrPluginUtils.flattenBooleanQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.util.SolrPluginUtils
的用法示例。
在下文中一共展示了SolrPluginUtils.flattenBooleanQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserQuery
import org.apache.solr.util.SolrPluginUtils; //导入方法依赖的package包/类
protected Query getUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, SolrParams solrParams)
throws SyntaxError {
String minShouldMatch = parseMinShouldMatch(req.getSchema(), solrParams);
Query dis = up.parse(userQuery);
Query query = dis;
if (dis instanceof BooleanQuery) {
BooleanQuery t = new BooleanQuery();
SolrPluginUtils.flattenBooleanQuery(t, (BooleanQuery) dis);
SolrPluginUtils.setMinShouldMatch(t, minShouldMatch);
query = t;
}
return query;
}
示例2: parseEscapedQuery
import org.apache.solr.util.SolrPluginUtils; //导入方法依赖的package包/类
/**
* Parses an escaped version of the user's query. This method is called
* in the event that the original query encounters exceptions during parsing.
*
* @param up parser used
* @param escapedUserQuery query that is parsed, should already be escaped so that no trivial parse errors are encountered
* @param config Configuration options for this parse request
* @return the resulting query (flattened if needed) with "min should match" rules applied as specified in the config.
* @see #parseOriginalQuery
* @see SolrPluginUtils#flattenBooleanQuery
*/
protected Query parseEscapedQuery(ExtendedSolrQueryParser up,
String escapedUserQuery, ExtendedDismaxConfiguration config) throws SyntaxError {
Query query = up.parse(escapedUserQuery);
if (query instanceof BooleanQuery) {
BooleanQuery t = new BooleanQuery();
SolrPluginUtils.flattenBooleanQuery(t, (BooleanQuery)query);
SolrPluginUtils.setMinShouldMatch(t, config.minShouldMatch);
query = t;
}
return query;
}