# Rank Feature Configuration

For some rank features, it is possible to set configuration variables for how the features are calculated. For features which are per field or attribute, the variables are set separately per field/attribute.

## Variables

Rank Features configuration variables are set by adding the following to the rank profile:

rank-properties {
<featurename>.<configuration-property>: <value>
}


Where <featurename> is the name of a feature class (feature name up to the first dot), <configuration-property> is a property from the list below, appropriate for the feature, and <value> is either a number of a quoted string. Example: set some properties on the fieldMatch and bm25 feature class of two different fields, and define custom outputs for the elementSimilarity feature for multi-valued field ranking.

ranking-profile my-profile inherits default {
rank-properties {
fieldMatch(title).maxAlternativeSegmentations: 10
fieldmatch(title).maxOccurrences: 5
fieldMatch(description).maxOccurrences: 20
bm25(title).k1: 1.5
bm25(title).b: 0.85
elementSimilarity(tags).output.sumWeightSquared: "sum((0.35*p+0.15*o+0.30*q+0.20*f)*w^2)"
elementSimilarity(tags).output.avgWeightSquared: "avg((0.35*p+0.15*o+0.30*q+0.20*f)*w^2)"
elementSimilarity(tags).output.sumWeight: "sum(w)"
}
match-features {
elementSimilarity(tags).sumWeightSquared
elementSimilarity(tags).sumWeight
bm25(title)
}
}


Note that rank profiles can be inherited to use the same variables in multiple profiles.

## Configuration Properties

FeatureParameterDefaultDescription
term numTerms 5

The number of terms for which this is included in the rank features dump in the summary

bm25 k1 1.2

Used to limit how much a single query term can affect the score for a document.

b 0.75 Used to control the effect of the field length compared to the average field length.
fieldMatch proximityLimit 10

The maximum allowed gap within a segment.

proximityTable 1/(2^(i/2)/3) for i in 9..0 followed by 1/2^(i/2) for i in 0..10 The proximity table deciding the importance of separations of various distances, The table must have size proximityLimit*2+1, where the first half is for reverse direction distances. The table must only contain values between 0 and 1, where 1 is "perfect" and 0 is "worst".
maxAlternativeSegmentations 10000 The maximum number of alternative segmentations allowed in addition to the first one found. This will prefer to not consider iterations on segments that are far out in the field, and which starts late in the query.
maxOccurrences 100 The number of occurrences the number of occurrences of each word is normalized against. This should be set as the number above which additional occurrences of the term has no real significance.
proximityCompletenessImportance 0.9 A number between 0 and 1 which determines the importance of field completeness in relation to query completeness in the match and completeness metrics.
relatednessImportance 0.9 The normalized importance of relatedness used in the match metric.
earlinessImportance 0.05 The importance of the match occurring early in the query, relative to segmentProximityImportance, occurrenceImportance and proximityCompletenessImportance in the match metric.
segmentProximityImportance 0.05 The importance of multiple segments being close to each other, relative to earlinessImportance, occurrenceImportance and proximityCompletenessImportance in the match metric.
occurrenceImportance 0.05 The importance of having many occurrences of the query terms, relative to earlinessImportance, segmentProximityImportance and proximityCompletenessImportance in the match metric.
fieldCompletenessImportance 0.05 A number between 0 and 1 which determines the importance of field completeness in relation to query completeness in the match and completeness metrics.
fieldTermMatch numTerms 5

The number of terms for which this is included in the rank features dump in the summary

numTerms.<fieldName> 5 The number of terms for which this is included in the rank features dump in the summary for the specified field
elementCompleteness fieldCompletenessImportance 0.5

Higher values favor field completeness, lower values favor query completeness. Adjusting this parameter will also affect which element is selected as the best.

elementSimilarity output.default "max((0.35*p+0.15*o+0.30*q+0.20*f)*w)"

Describes how the default output should be calculated. The value must be on the form aggregator(expression). The expression is used to combine the low-level similarity measures between the query and individual elements in the field. The aggregator will be used to aggregate the output of the expression across elements. The available aggregators are max, avg and sum. The available expression operators are +, -, *, / and ^. Parenthesis may be used to override default operator precedence. Note that you must quote the expression using "expression". Terminals can be numbers or any of the following symbols:

 p normalized proximity measure o normalized term ordering measure q normalized query coverage f normalized field coverage w element weight
output.name N/A Define an additional feature output called name. The value describes how the output should be calculated and has the same syntax as the default output described above. Example create a new output which can be accessed as elementSimilarity(tags).sumW: elementSimilarity(tags).output.sumW: "sum(w)"
attributeMatch fieldCompletenessImportance 0.05

A number between 0 and 1 which determines the importance of field completeness in relation to query completeness in the match and completeness metrics.

maxWeight 256 The maximal weight when calculating attributeMatch(<name>).normalizedWeight. Weights higher than this will not have any effect on this feature.
closeness maxDistance 9013305.0

The maximal distance when calculating closeness(<name>). Distances higher than this will not have any effect on this feature. The default is about 1000 km (1 km is about 9013.305 microdegrees).

scaleDistance 45066.525 Basic scale for distances when calculating closeness(<name>).logscale. The default is about 5 km.
halfResponse 593861.739 The distance that should give an output of 0.5 when calculating closeness(<name>).logscale. The default is about 65.89 km (must be in the range [1, maxDistance/2>). Use this parameter to fine tune the distance range where half of the dynamics of the logscale function will be used.
freshness maxAge 3*30*24*60*60

The maximal age in seconds when calculating freshness(<name>). Ages older than this will not have any effect on this feature. The default is about 3 months.

halfResponse 7*24*60*60 The age in seconds that should give an output of 0.5 when calculating freshness(<name>).logscale. The default is 7 days (must be in the range [1, maxAge/2>). Use this parameter to fine tune the age range where half of the dynamics of the logscale function will be used.
random seed Current time in microseconds

The random seed.

randomNormal seed Current time in microseconds

The random seed for randomNormal.

foreach maxTerms 16

Specifies how many query term indices to iterate over ([0, maxTerms>) when using dimension terms.