本文整理汇总了Java中org.apache.solr.common.params.SolrParams.wrapDefaults方法的典型用法代码示例。如果您正苦于以下问题:Java SolrParams.wrapDefaults方法的具体用法?Java SolrParams.wrapDefaults怎么用?Java SolrParams.wrapDefaults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.common.params.SolrParams
的用法示例。
在下文中一共展示了SolrParams.wrapDefaults方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public Query parse() throws SyntaxError {
parsed = true;
SolrParams solrParams = SolrParams.wrapDefaults(localParams, params);
queryFields = parseQueryFields(req.getSchema(), solrParams);
/* the main query we will execute. we disable the coord because
* this query is an artificial construct
*/
BooleanQuery query = new BooleanQuery(true);
boolean notBlank = addMainQuery(query, solrParams);
if (!notBlank)
return null;
addBoostQuery(query, solrParams);
addBoostFunctions(query, solrParams);
return query;
}
示例2: getFragmenter
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public Fragmenter getFragmenter(String fieldName, SolrParams params )
{
numRequests++;
params = SolrParams.wrapDefaults(params, defaults);
int fragsize = params.getFieldInt( fieldName, HighlightParams.FRAGSIZE, LuceneRegexFragmenter.DEFAULT_FRAGMENT_SIZE );
int increment = params.getFieldInt( fieldName, HighlightParams.INCREMENT, LuceneRegexFragmenter.DEFAULT_INCREMENT_GAP );
float slop = params.getFieldFloat( fieldName, HighlightParams.SLOP, LuceneRegexFragmenter.DEFAULT_SLOP );
int maxchars = params.getFieldInt( fieldName, HighlightParams.MAX_RE_CHARS, LuceneRegexFragmenter.DEFAULT_MAX_ANALYZED_CHARS );
String rawpat = params.getFieldParam( fieldName, HighlightParams.PATTERN, LuceneRegexFragmenter.DEFAULT_PATTERN_RAW );
Pattern p = rawpat == defaultPatternRaw ? defaultPattern : Pattern.compile(rawpat);
if( fragsize <= 0 ) {
return new NullFragmenter();
}
return new LuceneRegexFragmenter( fragsize, increment, slop, maxchars, p );
}
示例3: parse
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public Query parse() throws SyntaxError {
SolrParams localParams = getLocalParams();
SolrParams params = getParams();
SolrParams solrParams = SolrParams.wrapDefaults(localParams, params);
QParser baseParser = subQuery(solrParams.get(QueryParsing.V), null);
Query startNodesQuery = baseParser.getQuery();
String fromField = localParams.get("from", "node_id");
String toField = localParams.get("to", "edge_ids");
QParser traversalBaseParser = subQuery(localParams.get("traversalFilter"), null);
Query traversalFilter = traversalBaseParser.getQuery();
// TODO: un-invert this logic
boolean onlyLeafNodes = Boolean.valueOf(localParams.get("returnOnlyLeaf", "false"));
boolean returnStartNodes = Boolean.valueOf(localParams.get("returnRoot", "true"));
int maxDepth = Integer.valueOf(localParams.get("maxDepth", "-1"));
GraphQuery gq = new GraphQuery(startNodesQuery, fromField, toField, traversalFilter);
gq.setMaxDepth(maxDepth);
gq.setOnlyLeafNodes(onlyLeafNodes);
gq.setReturnStartNodes(returnStartNodes);
return gq;
}
示例4: getFragmentsBuilder
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
* Return a {@link org.apache.lucene.search.vectorhighlight.FragmentsBuilder} appropriate for this field.
*
* @param params The params controlling Highlighting
* @return An appropriate {@link org.apache.lucene.search.vectorhighlight.FragmentsBuilder}.
*/
public FragmentsBuilder getFragmentsBuilder(SolrParams params, BoundaryScanner bs) {
numRequests++;
params = SolrParams.wrapDefaults(params, defaults);
return getFragmentsBuilder( params, getPreTags( params, null ), getPostTags( params, null ), bs );
}
示例5: getTags
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private String[] getTags( SolrParams params, String paramName, String fieldName, String def ){
params = SolrParams.wrapDefaults(params, defaults);
String value = null;
if( fieldName == null )
value = params.get( paramName, def );
else
value = params.getFieldParam( fieldName, paramName, def );
String[] tags = value.split( "," );
for( int i = 0; i < tags.length; i++ ){
tags[i] = tags[i].trim();
}
return tags;
}
示例6: getFormatter
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public Formatter getFormatter(String fieldName, SolrParams params )
{
numRequests++;
params = SolrParams.wrapDefaults(params, defaults);
return new SimpleHTMLFormatter(
params.getFieldParam(fieldName, HighlightParams.SIMPLE_PRE, "<em>" ),
params.getFieldParam(fieldName, HighlightParams.SIMPLE_POST, "</em>"));
}
示例7: getFragmenter
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public Fragmenter getFragmenter(String fieldName, SolrParams params )
{
numRequests++;
params = SolrParams.wrapDefaults(params, defaults);
int fragsize = params.getFieldInt( fieldName, HighlightParams.FRAGSIZE, 100 );
return (fragsize <= 0) ? new NullFragmenter() : new LuceneGapFragmenter(fragsize);
}
示例8: assertNumFound
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
* Asserts the number of docs matching the SolrParams aganst the cloudClient
*/
private void assertNumFound(String msg, int expected, SolrParams p)
throws SolrServerException {
countNumFoundChecks++;
SolrParams params = SolrParams.wrapDefaults(params("rows","0"), p);
assertEquals(msg + ": " + params,
expected, cloudClient.query(params).getResults().getNumFound());
}
示例9: SimpleQParser
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public SimpleQParser (String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
super(qstr, localParams, params, req);
// Some of the parameters may come in through localParams, so combine them with params.
SolrParams defaultParams = SolrParams.wrapDefaults(localParams, params);
// This will be used to specify what fields and boosts will be used by SimpleQueryParser.
Map<String, Float> queryFields = SolrPluginUtils.parseFieldBoosts(defaultParams.get(SimpleParams.QF));
if (queryFields.isEmpty()) {
// It qf is not specified setup up the queryFields map to use the defaultField.
String defaultField = QueryParsing.getDefaultField(req.getSchema(), defaultParams.get(CommonParams.DF));
if (defaultField == null) {
// A query cannot be run without having a field or set of fields to run against.
throw new IllegalStateException("Neither " + SimpleParams.QF + ", " + CommonParams.DF
+ ", nor the default search field are present.");
}
queryFields.put(defaultField, 1.0F);
}
else {
for (Map.Entry<String, Float> queryField : queryFields.entrySet()) {
if (queryField.getValue() == null) {
// Some fields may be specified without a boost, so default the boost to 1.0 since a null value
// will not be accepted by SimpleQueryParser.
queryField.setValue(1.0F);
}
}
}
// Setup the operations that are enabled for the query.
int enabledOps = 0;
String opParam = defaultParams.get(SimpleParams.QO);
if (opParam == null) {
// All operations will be enabled.
enabledOps = -1;
} else {
// Parse the specified enabled operations to be used by the query.
String[] operations = opParam.split(",");
for (String operation : operations) {
Integer enabledOp = OPERATORS.get(operation.trim().toUpperCase(Locale.ROOT));
if (enabledOp != null) {
enabledOps |= enabledOp;
}
}
}
// Create a SimpleQueryParser using the analyzer from the schema.
final IndexSchema schema = req.getSchema();
parser = new SolrSimpleQueryParser(req.getSchema().getQueryAnalyzer(), queryFields, enabledOps, this, schema);
// Set the default operator to be either 'AND' or 'OR' for the query.
QueryParser.Operator defaultOp = QueryParsing.getQueryParserDefaultOperator(req.getSchema(), defaultParams.get(QueryParsing.OP));
if (defaultOp == QueryParser.Operator.AND) {
parser.setDefaultOperator(BooleanClause.Occur.MUST);
}
}
示例10: ExtendedDismaxConfiguration
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public ExtendedDismaxConfiguration(SolrParams localParams,
SolrParams params, SolrQueryRequest req) {
solrParams = SolrParams.wrapDefaults(localParams, params);
minShouldMatch = DisMaxQParser.parseMinShouldMatch(req.getSchema(), solrParams); // req.getSearcher() here causes searcher refcount imbalance
userFields = new UserFields(U.parseFieldBoosts(solrParams.getParams(DMP.UF)));
try {
queryFields = DisMaxQParser.parseQueryFields(req.getSchema(), solrParams); // req.getSearcher() here causes searcher refcount imbalance
} catch (SyntaxError e) {
throw new RuntimeException();
}
// Phrase slop array
int pslop[] = new int[4];
pslop[0] = solrParams.getInt(DisMaxParams.PS, 0);
pslop[2] = solrParams.getInt(DisMaxParams.PS2, pslop[0]);
pslop[3] = solrParams.getInt(DisMaxParams.PS3, pslop[0]);
List<FieldParams> phraseFields = U.parseFieldBoostsAndSlop(solrParams.getParams(DMP.PF),0,pslop[0]);
List<FieldParams> phraseFields2 = U.parseFieldBoostsAndSlop(solrParams.getParams(DMP.PF2),2,pslop[2]);
List<FieldParams> phraseFields3 = U.parseFieldBoostsAndSlop(solrParams.getParams(DMP.PF3),3,pslop[3]);
allPhraseFields = new ArrayList<>(phraseFields.size() + phraseFields2.size() + phraseFields3.size());
allPhraseFields.addAll(phraseFields);
allPhraseFields.addAll(phraseFields2);
allPhraseFields.addAll(phraseFields3);
tiebreaker = solrParams.getFloat(DisMaxParams.TIE, 0.0f);
qslop = solrParams.getInt(DisMaxParams.QS, 0);
stopwords = solrParams.getBool(DMP.STOPWORDS, true);
altQ = solrParams.get( DisMaxParams.ALTQ );
lowercaseOperators = solrParams.getBool(DMP.LOWERCASE_OPS, true);
/* * * Boosting Query * * */
boostParams = solrParams.getParams(DisMaxParams.BQ);
boostFuncs = solrParams.getParams(DisMaxParams.BF);
multBoosts = solrParams.getParams(DMP.MULT_BOOST);
}
示例11: getBoundaryScanner
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params){
numRequests++;
params = SolrParams.wrapDefaults(params, defaults);
return get(fieldName, params);
}
示例12: p
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrParams p(SolrParams params, String... other) {
SolrParams extras = params(other);
return SolrParams.wrapDefaults(params, extras);
}
示例13: setDefaults
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
* Set default-ish params on a SolrQueryRequest.
*
* RequestHandlers can use this method to ensure their defaults and
* overrides are visible to other components such as the response writer
*
* @param req The request whose params we are interested i
* @param defaults values to be used if no values are specified in the request params
* @param appends values to be appended to those from the request (or defaults) when dealing with multi-val params, or treated as another layer of defaults for singl-val params.
* @param invariants values which will be used instead of any request, or default values, regardless of context.
*/
public static void setDefaults(SolrQueryRequest req, SolrParams defaults,
SolrParams appends, SolrParams invariants) {
SolrParams p = req.getParams();
p = SolrParams.wrapDefaults(p, defaults);
p = SolrParams.wrapAppended(p, appends);
p = SolrParams.wrapDefaults(invariants, p);
req.setParams(p);
}