Skip to content

Instantly share code, notes, and snippets.

@fforbeck
Last active December 18, 2015 02:19
Show Gist options
  • Save fforbeck/5710097 to your computer and use it in GitHub Desktop.
Save fforbeck/5710097 to your computer and use it in GitHub Desktop.
Solr setup
<!-- FIELDS FOR NAVEGG USER DOCUMENT -->
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="gender" type="int" indexed="true" stored="true" multiValued="false" />
<field name="age" type="int" indexed="true" stored="true" multiValued="false" />
<field name="education" type="int" indexed="true" stored="true" multiValued="false" />
<field name="marital" type="int" indexed="true" stored="true" multiValued="false" />
<field name="income" type="int" indexed="true" stored="true" multiValued="false" />
<field name="connection" type="int" indexed="true" stored="true" multiValued="false" />
<field name="interest" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="product" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="brand" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="career" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="lookalike" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="cluster" type="text_general" indexed="true" stored="true" multiValued="true" />
<!-- END OF FIELDS FOR NAVEGG USER DOCUMENT -->
0. Installing - http://www.apache.org/dyn/closer.cgi/lucene/solr/4.3.0
1. Setup your fields types in solr/collections/conf/schema.xml
2. POST JSON -
curl http://localhost:8983/solr/update/json?commit=true --data-binary @file-name.json -H 'Content-type:application/json'
3. CLEAR DATABASE
curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
4. TUNNING
-> solrconfig.xml
<autoCommit>
<maxDocs>500000</maxDocs> <!-- Set high so that maxTime is the only relevant criteria -->
<maxTime>5000</maxTime> <!-- Autocommit every 5 seconds -->
</autoCommit>
<filterCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="256"/> <!-- see how to estimate the ideal size -->
See SolrConnector.java for query samples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment