Skip to content

Instantly share code, notes, and snippets.

View folkertsj's full-sized avatar

Joshua Folkerts folkertsj

View GitHub Profile
@peaeater
peaeater / alphanumeric-field-type.xml
Last active September 16, 2022 09:21
Alphanumeric field type for Solr which lowercases, removes leading articles, and forces numbers to sort numerically.
<fieldType name="alphaNumericSort" class="solr.TextField" sortMissingLast="false" omitNorms="true">
<analyzer>
<!-- KeywordTokenizer does no actual tokenizing, so the entire
input string is preserved as a single token
-->
<tokenizer class="solr.KeywordTokenizerFactory"/>
<!-- The LowerCase TokenFilter does what you expect, which can be
when you want your sorting to be case insensitive
-->
<filter class="solr.LowerCaseFilterFactory" />