11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

This filter adds a numeric floating point payload value to tokens that match a given type. Refer to the Javadoc for<br />

the org.apache.lucene.analysis.Token class for more information about token types and payloads.<br />

Factory class: solr.NumericPayloadTokenFilterFactory<br />

Arguments:<br />

payload: (required) A floating point value that will be added to all matching tokens.<br />

typeMatch: (required) A token type name string. Tokens with a matching type name will have their payload set<br />

to the above floating point value.<br />

Example:<br />

<br />

<br />

<br />

<br />

In: "bing bang boom"<br />

Tokenizer to Filter: "bing", "bang", "boom"<br />

Out: "bing"[0.75], "bang"[0.75], "boom"[0.75]<br />

Pattern Replace Filter<br />

This filter applies a regular expression to each token and, for those that match, substitutes the given replacement<br />

string in place of the matched pattern. Tokens which do not match are passed though unchanged.<br />

Factory class: solr.PatternReplaceFilterFactory<br />

Arguments:<br />

pattern: (required) The regular expression to test against each token, as per java.util.regex.Pattern.<br />

replacement: (required) A string to substitute in place of the matched pattern. This string may contain<br />

references to capture groups in the regex pattern. See the Javadoc for java.util.regex.Matcher.<br />

replace: ("all" or "first", default "all") Indicates whether all occurrences of the pattern in the token should be<br />

replaced, or only the first.<br />

Example:<br />

Simple string replace:<br />

<br />

<br />

<br />

<br />

In: "cat concatenate catycat"<br />

Tokenizer to Filter: "cat", "concatenate", "catycat"<br />

Out: "dog", "condogenate", "dogydog"<br />

Example:<br />

String replacement, first occurrence only:<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

130

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!