Data Importing From Database


1: Move into folder c:\project\apache-solr-1.4.0\example\solr\conf
2: Create data-config.xml file .
3: Type following code-
<dataConfig>
<dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/ofbiz" user="root" password="root“ />
    <document name="books">
 <entity name="books" pk="id" query="select id,name,price,category,publisher from books">
        <field column="id" name="id" />
        <field column="name" name="name" />
 <field column="price" name="price" />
        <field column="category" name="category" />
        <field column="publisher" name="publisher" />
</entity>
   </document>
</dataConfig>

1: open solrconfig.xml file
2: Copy the following code under the root tag of solrconfig.xml-
 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config“>c:/project/apache-solr-1.4.0/example/solr/conf/data-config.xml</str>
    </lst>
  </requestHandler>


1: Open the schema.xml file and copy the following info under in the schema tag-
<fields>
       <field name="id" type="string" indexed="true" stored="true"  />
        <field name="name" type="text" indexed="true" stored="true" />
 <field name="price" type="float" indexed="true" stored="true" />
<field name="category" type="string" indexed="true" stored="true" />
<field name="publisher" type="string" indexed="true" stored="true" />
<field name=“temp" type="text" indexed="true" stored=“false" multiValued="true" />
</fields>
 <uniqueKey>id</uniqueKey>
 <defaultSearchField>text</defaultSearchField>
 <solrQueryParser defaultOperator="OR" />


1: Type the following url-
2: Click /dataimport link.
3: Data import page will execute.
4: Click the debug button on this page.
5: It will show imported data right side of the page.
5: Type the following url for testing-
6: Type content that is related to your imported data.
7: This time will get xml response with record.



Comments

Popular posts from this blog

Dataload Utility In WCS

10 Steps to Configure Email – Websphere Commerce Server

Multiple Wish List