Skip to content

Instantly share code, notes, and snippets.

@jlecour
Created April 1, 2011 23:17
Show Gist options
  • Save jlecour/899035 to your computer and use it in GitHub Desktop.
Save jlecour/899035 to your computer and use it in GitHub Desktop.
Our Solr schema for an autocomplete of Geonames (with custom label)
<?xml version="1.0" encoding="UTF-8"?>
<schema name="sunspot" version="1.2">
<types>
<fieldType name="string"
class="solr.StrField"
sortMissingLast="true"
omitNorms="true"/>
<fieldType name="int" class="solr.TrieIntField"
precisionStep="0"
omitNorms="true"
positionIncrementGap="0"/>
<fieldType name="text_edge" class="solr.TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="id"
type="string" indexed="true" stored="true" required="true" />
<field name="type"
type="string" indexed="true" stored="false" required="true" />
<field name="label"
type="text_edge" indexed="false" stored="true" />
<field name="name"
type="text_edge" indexed="false" stored="false" />
<field name="alt_names"
type="text_edge" indexed="false" stored="false" multiValued="true"/>
<field name="nbr_hotels"
type="int" indexed="true" stored="true" />
<field name="country"
type="string" indexed="true" stored="false" />
<field name="population"
type="int" indexed="true" stored="false" />
<field name="feature_class"
type="string" indexed="true" stored="false" />
<field name="feature_code"
type="string" indexed="true" stored="false" />
<field name="text"
type="text_edge" indexed="true" stored="false" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<copyField source="name" dest="text"/>
<copyField source="alt_names" dest="text"/>
<solrQueryParser defaultOperator="AND"/>
</schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment