CristianSitov / UsingSolr5.2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UsingSolr5.2

  1. Install Solr
  • run install service command
  • start service
  • access SOLR URL
  1. Add libraries
  1. Setup a new collection
  • create folders
    • /opt/solr/example/teste/conf
    • /opt/solr/example/teste/data
  • copy sample from /opt/solr/server/solr/configsets/data_driven_schema_configs/
  • chown copied folder
  • edit solrconfig.xml
  1. Create configuration files
  • add data-import.xml (see code below)
  1. Create Core from UI
  • instanceDir: /opt/solr/example/teste/
  • dataDir: /opt/solr/example/teste/data/
  1. Reload service + create Core again to trigger presence/detection
<dataConfig>
<dataSource type="JdbcDataSource"
            driver="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/core"
            user="root"
            password=""/>
<document>
  <entity name="messages"
    pk="id"
    query="select id,message from messages"
    deltaImportQuery="SELECT id,message from messages WHERE id='${dih.delta.id}'"
    deltaQuery="SELECT id FROM messages WHERE created > '${dih.last_index_time}'"
    >
     <field column="id" name="id"/>
     <field column="message" name="message"/>
  </entity>
</document>
</dataConfig>

Test

  1. Import via DIH UI
  • import as it is
  • query as it is
  1. Change indexed fields
  • add field in schema.xml, reload & reindex
  • query for changes

About