Skip to content

Instantly share code, notes, and snippets.

@prasad83
Forked from jeremy/schema.xml
Created March 12, 2012 05:05
Show Gist options
  • Save prasad83/2019915 to your computer and use it in GitHub Desktop.
Save prasad83/2019915 to your computer and use it in GitHub Desktop.
Basecamp Solr schema
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="basecamp" version="1.3">
<types>
<!-- indexed/stored verbatim -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- binary data, base64 -->
<fieldtype name="binary" class="solr.BinaryField"/>
<!-- numbers -->
<fieldType name="integer" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<!-- for faster range queries and faceting -->
<fieldType name="tinteger" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<!-- dates: 1995-12-31T23:59:59.99Z -->
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<!-- for faster range queries and faceting -->
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" omitNorms="true" positionIncrementGap="0"/>
<!-- to create a pseudo-random ordering -->
<fieldType name="random" class="solr.RandomSortField" indexed="true" />
<!-- general roman text -->
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<!-- english: roman + stemming -->
<fieldtype name="text_en" class="solr.TextField">
<analyzer>
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
</analyzer>
</fieldtype>
<!-- chinese, japanese, korean -->
<fieldType name="text_cjk" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.CJKTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
</analyzer>
</fieldType>
<!-- for exact word matches -->
<fieldType name="text_exact" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
</analyzer>
</fieldType>
<!-- for prefix queries like foo* -->
<fieldType name="text_prefix" class="solr.TextField" positionIncrementGap="1">
<analyzer type="index">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="16" />
</analyzer>
<analyzer type="query">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
<!-- for suffix queries like *bar -->
<fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ReversedWildcardFilterFactory" withOriginal="true" maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
</analyzer>
<analyzer type="query">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<!-- don't index or store -->
<fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="indexed_at" type="date" indexed="true" stored="true" default="NOW"/>
<field name="model_id" type="tinteger" indexed="true" stored="true" required="true"/>
<field name="model_class" type="string" indexed="true" stored="true" required="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<field name="model_base_class" type="string" indexed="true" stored="true" required="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<field name="title_text" type="text" indexed="true" stored="false"/>
<field name="title_text_en" type="text_en" indexed="true" stored="false"/>
<field name="title_text_cjk" type="text_cjk" indexed="true" stored="false"/>
<field name="title_text_exact" type="text_exact" indexed="true" stored="false"/>
<field name="title_text_prefix" type="text_prefix" indexed="true" stored="false"/>
<field name="title_text_rev" type="text_rev" indexed="true" stored="false"/>
<field name="search_terms_text" type="text" indexed="true" stored="false"/>
<field name="search_terms_text_en" type="text_en" indexed="true" stored="false"/>
<field name="search_terms_text_cjk" type="text_cjk" indexed="true" stored="false"/>
<field name="search_terms_text_exact" type="text_exact" indexed="true" stored="false"/>
<field name="search_terms_text_prefix" type="text_prefix" indexed="true" stored="false"/>
<field name="search_terms_text_rev" type="text_rev" indexed="true" stored="false"/>
<dynamicField name="*_integer" type="tinteger" indexed="true" stored="false"/>
<dynamicField name="*_string" type="string" indexed="true" stored="false" omitNorms="true" omitTermFreqAndPositions="true"/>
<dynamicField name="*_boolean" type="boolean" indexed="true" stored="false"/>
<dynamicField name="*_datetime" type="tdate" indexed="true" stored="false"/>
<dynamicField name="*" type="ignored" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>search_terms_text</defaultSearchField>
<solrQueryParser defaultOperator="AND"/>
<copyField source="search_terms_text" dest="search_terms_text_en"/>
<copyField source="search_terms_text" dest="search_terms_text_cjk"/>
<copyField source="search_terms_text" dest="search_terms_text_exact"/>
<copyField source="search_terms_text" dest="search_terms_text_prefix"/>
<copyField source="search_terms_text" dest="search_terms_text_rev"/>
<copyField source="title_text" dest="title_text_en"/>
<copyField source="title_text" dest="title_text_cjk"/>
<copyField source="title_text" dest="title_text_exact"/>
<copyField source="title_text" dest="title_text_prefix"/>
<copyField source="title_text" dest="title_text_rev"/>
</schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment