本文整理汇总了Java中org.apache.solr.common.params.SolrParams.getFieldInt方法的典型用法代码示例。如果您正苦于以下问题:Java SolrParams.getFieldInt方法的具体用法?Java SolrParams.getFieldInt怎么用?Java SolrParams.getFieldInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.common.params.SolrParams
的用法示例。
在下文中一共展示了SolrParams.getFieldInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillParams
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
protected void fillParams(ResponseBuilder rb, SolrParams params, String field) {
this.field = field;
this.ftype = rb.req.getSchema().getFieldTypeNoEx(this.field);
this.offset = params.getFieldInt(field, FacetParams.FACET_OFFSET, 0);
this.limit = params.getFieldInt(field, FacetParams.FACET_LIMIT, 100);
Integer mincount = params.getFieldInt(field, FacetParams.FACET_MINCOUNT);
if (mincount == null) {
Boolean zeros = params.getFieldBool(field, FacetParams.FACET_ZEROS);
// mincount = (zeros!=null && zeros) ? 0 : 1;
mincount = (zeros != null && !zeros) ? 1 : 0;
// current default is to include zeros.
}
this.minCount = mincount;
this.missing = params.getFieldBool(field, FacetParams.FACET_MISSING, false);
// default to sorting by count if there is a limit.
this.sort = params.getFieldParam(field, FacetParams.FACET_SORT,
(limit > 0 ?
FacetParams.FACET_SORT_COUNT
: FacetParams.FACET_SORT_INDEX));
if (this.sort.equals(FacetParams.FACET_SORT_COUNT_LEGACY)) {
this.sort = FacetParams.FACET_SORT_COUNT;
} else if (this.sort.equals(FacetParams.FACET_SORT_INDEX_LEGACY)) {
this.sort = FacetParams.FACET_SORT_INDEX;
}
this.prefix = params.getFieldParam(field, FacetParams.FACET_PREFIX);
}
示例2: PivotFacetField
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private PivotFacetField(ResponseBuilder rb, PivotFacetValue parent, String fieldName) {
field = fieldName;
parentValue = parent;
// facet params
SolrParams parameters = rb.req.getParams();
facetFieldMinimumCount = parameters.getFieldInt(field, FacetParams.FACET_PIVOT_MINCOUNT, 1);
facetFieldOffset = parameters.getFieldInt(field, FacetParams.FACET_OFFSET, 0);
facetFieldLimit = parameters.getFieldInt(field, FacetParams.FACET_LIMIT, 100);
String defaultSort = (facetFieldLimit > 0) ? FacetParams.FACET_SORT_COUNT : FacetParams.FACET_SORT_INDEX;
facetFieldSort = parameters.getFieldParam(field, FacetParams.FACET_SORT, defaultSort);
valueCollection = new PivotFacetFieldValueCollection(facetFieldMinimumCount, facetFieldOffset, facetFieldLimit, facetFieldSort);
if ( (facetFieldLimit < 0) ||
// TODO: possible refinement issue if limit=0 & mincount=0 & missing=true
// (ie: we only want the missing count for this field)
(facetFieldLimit <= 0 && facetFieldMinimumCount == 0) ||
(facetFieldSort.equals(FacetParams.FACET_SORT_INDEX) && facetFieldMinimumCount <= 0)
) {
// in any of these cases, there's no need to refine this level of the pivot
needRefinementAtThisLevel = false;
}
}
示例3: 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 );
}
示例4: doHighlighting
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public NamedList<Object> doHighlighting(DocList docs, Query query, SolrQueryRequest req, String[] defaultFields) throws IOException {
final SolrParams params = req.getParams();
// if highlighting isnt enabled, then why call doHighlighting?
if (!isHighlightingEnabled(params))
return null;
SolrIndexSearcher searcher = req.getSearcher();
int[] docIDs = toDocIDs(docs);
// fetch the unique keys
String[] keys = getUniqueKeys(searcher, docIDs);
// query-time parameters
String[] fieldNames = getHighlightFields(query, req, defaultFields);
int maxPassages[] = new int[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
maxPassages[i] = params.getFieldInt(fieldNames[i], HighlightParams.SNIPPETS, 1);
}
PostingsHighlighter highlighter = getHighlighter(req);
Map<String,String[]> snippets = highlighter.highlightFields(fieldNames, query, searcher, docIDs, maxPassages);
return encodeSnippets(keys, fieldNames, snippets);
}
示例5: fillParams
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
protected void fillParams(ResponseBuilder rb, SolrParams params, String field) {
super.fillParams(rb, params, field);
this.overrequestRatio
= params.getFieldDouble(field, FacetParams.FACET_OVERREQUEST_RATIO, 1.5);
this.overrequestCount
= params.getFieldInt(field, FacetParams.FACET_OVERREQUEST_COUNT, 10);
this.mco
= params.getFieldBool(field, FacetParams.FACET_DISTRIB_MCO, false);
}
示例6: get
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
protected BoundaryScanner get(String fieldName, SolrParams params) {
int maxScan = params.getFieldInt(fieldName, HighlightParams.BS_MAX_SCAN, 10);
String str = params.getFieldParam(fieldName, HighlightParams.BS_CHARS, ".,!? \t\n");
Character[] chars = new Character[str.length()];
for(int i = 0; i < str.length(); i++){
chars[i] = str.charAt(i);
}
return new org.apache.lucene.search.vectorhighlight.SimpleBoundaryScanner(maxScan, chars);
}
示例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: modifyRequestForIndividualPivotFacets
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private void modifyRequestForIndividualPivotFacets(ResponseBuilder rb, ShardRequest sreq,
String fieldToOverRequest) {
final SolrParams originalParams = rb.req.getParams();
final String paramStart = "f." + fieldToOverRequest + ".";
final int requestedLimit = originalParams.getFieldInt(fieldToOverRequest,
FacetParams.FACET_LIMIT, 100);
sreq.params.remove(paramStart + FacetParams.FACET_LIMIT);
final int offset = originalParams.getFieldInt(fieldToOverRequest,
FacetParams.FACET_OFFSET, 0);
sreq.params.remove(paramStart + FacetParams.FACET_OFFSET);
final double overRequestRatio = originalParams.getFieldDouble
(fieldToOverRequest, FacetParams.FACET_OVERREQUEST_RATIO, 1.5);
sreq.params.remove(paramStart + FacetParams.FACET_OVERREQUEST_RATIO);
final int overRequestCount = originalParams.getFieldInt
(fieldToOverRequest, FacetParams.FACET_OVERREQUEST_COUNT, 10);
sreq.params.remove(paramStart + FacetParams.FACET_OVERREQUEST_COUNT);
final int requestedMinCount = originalParams.getFieldInt
(fieldToOverRequest, FacetParams.FACET_PIVOT_MINCOUNT, 1);
sreq.params.remove(paramStart + FacetParams.FACET_PIVOT_MINCOUNT);
final String defaultSort = (requestedLimit > 0)
? FacetParams.FACET_SORT_COUNT : FacetParams.FACET_SORT_INDEX;
final String sort = originalParams.getFieldParam
(fieldToOverRequest, FacetParams.FACET_SORT, defaultSort);
int shardLimit = requestedLimit + offset;
int shardMinCount = requestedMinCount;
// per-shard mincount & overrequest
if ( FacetParams.FACET_SORT_INDEX.equals(sort) &&
1 < requestedMinCount &&
0 < requestedLimit) {
// We can divide the mincount by num shards rounded up, because unless
// a single shard has at least that many it can't compete...
shardMinCount = (int) Math.ceil((double) requestedMinCount / rb.slices.length);
// ...but we still need to overrequest to reduce chances of missing something
shardLimit = doOverRequestMath(shardLimit, overRequestRatio, overRequestCount);
// (for mincount <= 1, no overrequest needed)
} else if ( FacetParams.FACET_SORT_COUNT.equals(sort) ) {
if ( 0 < requestedLimit ) {
shardLimit = doOverRequestMath(shardLimit, overRequestRatio, overRequestCount);
shardMinCount = 0;
} else {
shardMinCount = Math.min(requestedMinCount, 1);
}
}
sreq.params.set(paramStart + FacetParams.FACET_LIMIT, shardLimit);
sreq.params.set(paramStart + FacetParams.FACET_PIVOT_MINCOUNT, shardMinCount);
}
示例9: getMaxSnippets
import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
* Return the max number of snippets for this field. If this has not
* been configured for this field, fall back to the configured default
* or the solr default.
* @param fieldName The name of the field
* @param params The params controlling Highlighting
*/
protected int getMaxSnippets(String fieldName, SolrParams params) {
return params.getFieldInt(fieldName, HighlightParams.SNIPPETS,1);
}