热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.solr.client.solrj.SolrQuery.setFilterQueries()方法的使用及代码示例

本文整理了Java中org.apache.solr.client.solrj.SolrQuery.setFilterQueries()方法的一些代码示例,展示了

本文整理了Java中org.apache.solr.client.solrj.SolrQuery.setFilterQueries()方法的一些代码示例,展示了SolrQuery.setFilterQueries()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SolrQuery.setFilterQueries()方法的具体详情如下:
包路径:org.apache.solr.client.solrj.SolrQuery
类名称:SolrQuery
方法名:setFilterQueries

SolrQuery.setFilterQueries介绍

暂无

代码示例

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

solrQuery.setFilterQueries(filterQueries);

代码示例来源:origin: spring-projects/spring-data-solr

/**
* Set filter filter queries for {@link SolrQuery}
*
* @param solrQuery
* @param filterQueries
* @param domainType used for mapping fields to properties. Can be {@literal null}.
*/
protected void appendFilterQuery(SolrQuery solrQuery, List filterQueries,
@Nullable Class domainType) {
if (CollectionUtils.isEmpty(filterQueries)) {
return;
}
List filterQueryStrings = getFilterQueryStrings(filterQueries, domainType);
if (!filterQueryStrings.isEmpty()) {
solrQuery.setFilterQueries(convertStringListToArray(filterQueryStrings));
}
}

代码示例来源:origin: org.phenotips/vocabulary-hpo-api

private SolrQuery addDynamicQueryParameters(String originalQuery, Integer rows, String sort, String customFq,
boolean isId, SolrQuery query)
{
String queryString = originalQuery.trim();
String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (isId) {
query.setFilterQueries(StringUtils.defaultIfBlank(customFq,
new MessageFormat("id:{0} alt_id:{0}").format(new String[] { escapedQuery })));
} else {
query.setFilterQueries(StringUtils.defaultIfBlank(customFq, "term_category:HP\\:0000118"));
}
query.setQuery(escapedQuery);
query.set(SpellingParams.SPELLCHECK_Q, queryString);
query.setRows(rows);
if (StringUtils.isNotBlank(sort)) {
for (String sortItem : sort.split("\\s*,\\s*")) {
query.addSort(StringUtils.substringBefore(sortItem, " "),
sortItem.endsWith(" desc") || sortItem.startsWith("-") ? ORDER.desc : ORDER.asc);
}
}
return query;
}

代码示例来源:origin: phenotips/phenotips

private SolrQuery addDynamicQueryParameters(String originalQuery, Integer rows, String sort, String customFq,
boolean isId, SolrQuery query)
{
String queryString = originalQuery.trim();
String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (isId) {
query.setFilterQueries(StringUtils.defaultIfBlank(customFq,
new MessageFormat("id:{0} alt_id:{0}").format(new String[] { escapedQuery })));
} else if (StringUtils.isNotBlank(customFq)) {
query.setFilterQueries(customFq);
}
query.setQuery(escapedQuery);
query.set(SpellingParams.SPELLCHECK_Q, queryString);
query.setRows(rows);
if (StringUtils.isNotBlank(sort)) {
for (String sortItem : sort.split("\\s*,\\s*")) {
query.addSort(StringUtils.substringBefore(sortItem, " "),
sortItem.endsWith(" desc") || sortItem.startsWith("-") ? ORDER.desc : ORDER.asc);
}
}
return query;
}

代码示例来源:origin: org.phenotips/vocabulary-ethnicity-api

private SolrQuery addDynamicQueryParameters(String originalQuery, Integer rows, String sort, String customFq,
boolean isId, SolrQuery query)
{
String queryString = originalQuery.trim();
String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (isId) {
query.setFilterQueries(new MessageFormat("id:{0}").format(new String[] { escapedQuery }));
}
query.setQuery(escapedQuery);
query.set(SpellingParams.SPELLCHECK_Q, queryString);
query.setRows(rows);
if (StringUtils.isNotBlank(sort)) {
for (String sortItem : sort.split("\\s*,\\s*")) {
query.addSort(StringUtils.substringBefore(sortItem, " "),
sortItem.endsWith(" desc") || sortItem.startsWith("-") ? ORDER.desc : ORDER.asc);
}
}
return query;
}

代码示例来源:origin: phenotips/phenotips

private SolrQuery addDynamicQueryParameters(String originalQuery, Integer rows, String sort, String customFq,
boolean isId, SolrQuery query)
{
String queryString = originalQuery.trim();
String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (isId) {
query.setFilterQueries(new MessageFormat("id:{0}").format(new String[] { escapedQuery }));
}
query.setQuery(escapedQuery);
query.set(SpellingParams.SPELLCHECK_Q, queryString);
query.setRows(rows);
if (StringUtils.isNotBlank(sort)) {
for (String sortItem : sort.split("\\s*,\\s*")) {
query.addSort(StringUtils.substringBefore(sortItem, " "),
sortItem.endsWith(" desc") || sortItem.startsWith("-") ? ORDER.desc : ORDER.asc);
}
}
return query;
}

代码示例来源:origin: phenotips/phenotips

final String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (StringUtils.isNotBlank(customFilter)) {
query.setFilterQueries(customFilter);

代码示例来源:origin: org.phenotips/vocabulary-ordo-api

final String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (StringUtils.isNotBlank(customFilter)) {
query.setFilterQueries(customFilter);

代码示例来源:origin: phenotips/phenotips

final String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (StringUtils.isNotBlank(customFilter)) {
query.setFilterQueries(customFilter);

代码示例来源:origin: phenotips/phenotips

private SolrQuery addDynamicQueryParameters(String originalQuery, Integer rows, String sort, String customFq,
SolrQuery query)
{
String queryString = originalQuery.trim();
String escapedQuery = ClientUtils.escapeQueryChars(queryString);
query.setFilterQueries(StringUtils.defaultIfBlank(customFq, DEFAULT_DISEASE_FILTER));
query.setQuery(escapedQuery);
query.set(SpellingParams.SPELLCHECK_Q, queryString);
String lastWord = StringUtils.substringAfterLast(escapedQuery, " ");
if (StringUtils.isBlank(lastWord)) {
lastWord = escapedQuery;
}
lastWord += "*";
query.set(DisMaxParams.BQ,
String.format("nameSpell:%1$s^20 short_name:%1$s^20 synonymSpell:%1$s^12 text:%1$s^1 textSpell:%1$s^2",
lastWord));
query.setRows(rows);
if (StringUtils.isNotBlank(sort)) {
for (String sortItem : sort.split("\\s*,\\s*")) {
query.addSort(StringUtils.substringBefore(sortItem, " "),
sortItem.endsWith(" desc") || sortItem.startsWith("-") ? ORDER.desc : ORDER.asc);
}
}
return query;
}

代码示例来源:origin: org.phenotips/vocabulary-orphanet-api

final String escapedQuery = ClientUtils.escapeQueryChars(queryString);
if (StringUtils.isNotBlank(customFilter)) {
query.setFilterQueries(customFilter);

代码示例来源:origin: org.mycore/mycore-oai

private SolrQuery getQuery() {
SolrQuery solrQuery = new SolrQuery();
MCRConfiguration cOnfig= MCRConfiguration.instance();
// query
String idQuery = getResult().stream()
.map(getIdentifier())
.map(MCRSolrUtils::escapeSearchValue)
.collect(Collectors.joining(" OR ", "id:(", ")"));
solrQuery.setQuery(idQuery);
solrQuery.setFilterQueries(query);
solrQuery.setFields("id");
solrQuery.setRows(getResult().size());
// request handler
solrQuery.setRequestHandler(config.getString(getConfigPrefix() + "Search.RequestHandler", "/select"));
return solrQuery;
}

代码示例来源:origin: openimaj/openimaj

/**
* @param query
* @param nRows
* @param fields
* @param filter
* @return the response
* @throws SolrServerException
*/
public QueryResponse query(String query, int nRows, String[] fields,String filter) throws SolrServerException {
SolrQuery q = new SolrQuery();
q.setQuery(query);
q.setRows(nRows);
q.setFields(fields);
if (filter != null) {
q.setFilterQueries(filter);
}
q.setFacet(false);
return solrIndex.query(q);
}
}

代码示例来源:origin: org.openimaj/geocoder

/**
* @param query
* @param nRows
* @param fields
* @param filter
* @return the response
* @throws SolrServerException
*/
public QueryResponse query(String query, int nRows, String[] fields,String filter) throws SolrServerException {
SolrQuery q = new SolrQuery();
q.setQuery(query);
q.setRows(nRows);
q.setFields(fields);
if (filter != null) {
q.setFilterQueries(filter);
}
q.setFacet(false);
return solrIndex.query(q);
}
}

代码示例来源:origin: org.apache.solr/solr-dataimporthandler

solrQuery.setFilterQueries(filterQueries);

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.engine.topic

SolrQuery query = new SolrQuery();
query.setRequestHandler("/" + MoreLikeThisParams.MLT);
query.setFilterQueries(entryTypeField + ":" + MODEL_ENTRY);
query.set(MoreLikeThisParams.MATCH_INCLUDE, false);
query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1);

代码示例来源:origin: apache/stanbol

SolrQuery query = new SolrQuery();
query.setRequestHandler("/" + MoreLikeThisParams.MLT);
query.setFilterQueries(entryTypeField + ":" + MODEL_ENTRY);
query.set(MoreLikeThisParams.MATCH_INCLUDE, false);
query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1);

代码示例来源:origin: org.geotools/gt-solr

fq = fq != null ? fq + " AND " + ffq : ffq;
query.setFilterQueries(fq);

代码示例来源:origin: headwirecom/aem-solr-search

query.setFilterQueries(uniquefilterQueries.toArray(new String[uniquefilterQueries.size()]));

代码示例来源:origin: org.geotools/gt-solr

fq = fq != null ? fq + " AND " + ffq : ffq;
query.setFilterQueries(fq);

推荐阅读
author-avatar
mobiledu2502890617
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有