Skip to content

Instantly share code, notes, and snippets.

@rduplain
Created February 17, 2011 20:02
Show Gist options
  • Select an option

  • Save rduplain/832539 to your computer and use it in GitHub Desktop.

Select an option

Save rduplain/832539 to your computer and use it in GitHub Desktop.
Sample prototyping schema for use with vanilla Apache Solr 1.4.1 download.

Sample prototyping schema for use with vanilla Apache Solr 1.4.1 download.

tar -xvzf ~/download/apache-solr-1.4.1.tgz
cd apache-solr-1.4.1/example/
vi solr/conf/schema.xml # edit into something like the schema here
java -jar start.jar # look for errors, otherwise have fun!

Start prototyping! To clean out the data index and start over, interrupt the Jetty server (Control-C) and:

rm -fr solr/data/
java -jar start.jar
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.2">
<!-- See apache-solr-1.4.1/example/solr/conf/schema.xml for excellently commented schema.xml. -->
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<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="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*" type="text" indexed="true" stored="true"/>
<dynamicField name="*_list" type="text" indexed="true" stored="true" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="AND"/>
<copyField source="*" dest="text"/>
</schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment