Skip to content

Instantly share code, notes, and snippets.

@rchukh
Last active February 12, 2018 05:50
Show Gist options
  • Save rchukh/7385672 to your computer and use it in GitHub Desktop.
Save rchukh/7385672 to your computer and use it in GitHub Desktop.
# Schema:
<schema name="elogging" version="1.5">
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="name_text" type="text" indexed="true" stored="true" required="true" />
<field name="description_text" type="text" indexed="true" stored="true" required="true" />
<field name="brand_text" type="text" indexed="true" stored="true" required="true" />
<field name="retailer_text" type="text" indexed="true" stored="true" required="true" />
<field name="options" type="text" indexed="true" stored="true" required="true" multiValued="true"/>
<field name="taxons" type="descendent_path" indexed="true" stored="true" required="true" multiValued="true"/>
<field name="count_on_hand" type="long" indexed="true" stored="true" required="true" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<types>
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="uuid" class="solr.UUIDField" indexed="true"/>
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory" catenateWords="1" catenateAll="1" preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory" catenateWords="1" catenateAll="1" preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
<filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
</analyzer>
</fieldType>
<fieldType name="descendent_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory" />
</analyzer>
</fieldType>
</types>
<updateRequestProcessorChain name="uniq-fields">
<processor class="org.apache.solr.update.processor.UniqFieldsUpdateProcessorFactory">
<lst name="fields">
<str>id</str>
</lst>
</processor>
<processor class="solr.RunUpdateProcessorFactory"/>
</updateRequestProcessorChain>
</schema>
# Data
[
{
"id": 1,
"brand_text": "Riddle",
"count_on_hand": "321",
"description_text": "The Riddle Shirt Tech Men's Hoodie features signature details, along with ultra-lightweight fleece for optimum warmth.",
"name_text": "Riddle-Shirt Tech",
"options": [
"color_red",
"color_blue",
"size_39",
"size_40"
],
"retailer_text": "Supershop",
"taxons": [
"cat1",
"cat1/cat2",
"cat1/cat2/cat3",
"cat1/cat4"
]
}
,
{
"id": 2,
"brand_text": "The Unknown",
"count_on_hand": "999",
"description_text": "The Unknown Shirt for women.",
"name_text": "Unknown-Shirt",
"options": [
"color_blue",
"size_40"
],
"retailer_text": "Enigma",
"taxons": [
"who/knows/where"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment