Title: Gora HBase Module
This is the main documentation for the gora-solr module. gora-solr module enables Apache Solr backend support for Gora.
Say we wished to map some Employee data and store it into the SolrStore.
<gora-otd> <class name="org.apache.gora.examples.generated.Employee" keyClass="java.lang.String" table="Employee"> <primarykey column="ssn"/> <field name="name" column="name"/> <field name="dateOfBirth" column="dateOfBirth"/> <field name="salary" column="salary"/> <field name="boss" column="boss"/> <field name="webpage" column="webpage"/> </class> </gora-otd>
Here you can see that we require the definition of only one child element within the gora-otd mapping configuration, namely;
The class element where we specify of persistent fields which values should map to. This contains;
a parameter containing the Persistent class name e.g. org.apache.gora.examples.generated.Employee,
a parameter containing the keyClass e.g. java.lang.String which specifies the keys which map to the field values,
a parameter containing the Table name e.g. Employee,
finally nested child element(s) mapping fields which are to be persisted into Solr. We must provide a primary key for each object that we wish to persist into Solr. Additional object fields need to be configured such that they receive;
a parameter containing the name e.g. (name, dateOfBirth, ssn, salary, boss and webpage respectively),
a parameter containing the column family to which they belong e.g. (all info in this case),
schema.xml is an essential aspect of defining a storage and query model for your Solr data.
The Solr community maintain their own documentation relating to schema.xml, this can be found at http://wiki.apache.org/solr/SchemaXml.
<schema name="testexample" version="1.5"> <fields> <!-- Common Fields --> <field name="_version_" type="long" indexed="true" stored="true"/> <!-- Employee Fields --> <field name="ssn" type="string" indexed="true" stored="true" required="true" multiValued="false" /> <field name="name" type="string" indexed="true" stored="true" /> <field name="dateOfBirth" type="long" stored="true" /> <field name="salary" type="int" stored="true" /> <field name="boss" type="binary" stored="true" /> <field name="webpage" type="binary" stored="true" /> </fields> <uniqueKey>ssn</uniqueKey> <types> <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/> <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> <fieldtype name="binary" class="solr.BinaryField"/> </types> </schema>
Similar to schema.xml above, solrconfig.xml documentation is also maintained by the Solr community.
Please see an example configuration below but also please refer to http://wiki.apache.org/solr/SolrConfigXml.
<config> <luceneMatchVersion>LUCENE_40</luceneMatchVersion> <dataDir>${solr.data.dir:}</dataDir> <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/> <codecFactory class="solr.SchemaCodecFactory"/> <schemaFactory class="ClassicIndexSchemaFactory"/> <indexConfig> <lockType>${solr.lock.type:native}</lockType> </indexConfig> <jmx /> <updateHandler class="solr.DirectUpdateHandler2"> <updateLog> <str name="dir">${solr.ulog.dir:}</str> </updateLog> </updateHandler> <query> <maxBooleanClauses>1024</maxBooleanClauses> <filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/> <queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/> <documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/> <enableLazyFieldLoading>true</enableLazyFieldLoading> <queryResultWindowSize>20</queryResultWindowSize> <queryResultMaxDocsCached>200</queryResultMaxDocsCached> <listener event="newSearcher" class="solr.QuerySenderListener"> <arr name="queries"> </arr> </listener> <listener event="firstSearcher" class="solr.QuerySenderListener"> <arr name="queries"> <lst> <str name="q">static firstSearcher warming in solrconfig.xml</str> </lst> </arr> </listener> <useColdSearcher>false</useColdSearcher> <maxWarmingSearchers>2</maxWarmingSearchers> </query> <requestDispatcher handleSelect="false" > <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" formdataUploadLimitInKB="2048" addHttpRequestToContext="false"/> <httpCaching never304="true" /> </requestDispatcher> <requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int> <str name="df">ssn</str> </lst> </requestHandler> <requestHandler name="/query" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <str name="wt">json</str> <str name="indent">true</str> <str name="df">ssn</str> </lst> </requestHandler> <requestHandler name="/get" class="solr.RealTimeGetHandler"> <lst name="defaults"> <str name="omitHeader">true</str> </lst> </requestHandler> <requestHandler name="/update" class="solr.UpdateRequestHandler"> </requestHandler> </config>