Current time: 01-28-2021, 07:44 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Query Search Time
09-28-2010, 09:44 PM
Post: #50
RE: Database Query Search Time
Hey Guys,

This post will explain how to setup an extremely simple DataImportHandler for SOLR using a MS SQL Server 2005 database.

First, you will need to add some code to the solrconfig.xml file as follows:

Code:
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">F:\collections\products_id8\conf\data-config.xml</str>
  </lst>
</requestHandler>

The data-config.xml will be exactly as follows:

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
  <dataSource type="JdbcDataSource" name="GreenEarth3" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
  url="jdbc:sqlserver://localhost;databaseName=myDSNName;responseBuffering=adaptive;" user="myUsername" password="myPassword" />
  <document name="products">
    <entity name="myProduct" dataSource="myDSNName" pk="PRODUCT_ID" query="SELECT PRODUCT_ID FROM TESTPRODUCT">
      <field column="PRODUCT_ID" name="PRODUCT_ID" />        
    </entity>      
  </document>
</dataConfig>

In the schema.xml file, I have the <fields> section as follows:

Code:
<fields>
  <field name="PRODUCT_ID" type="integer" indexed="true" stored="true" required="true" />
  <field name="contents" type="text" indexed="true" stored="false" required="false" multiValued="true" omitNorms="true" />
</fields>

<uniqueKey>PRODUCT_ID</uniqueKey>

You will also need to get a copy of the JAR file found here:
http://www.microsoft.com/downloads/en/de...66235EFC7C

The sqljdbc.jar file must be placed in "C:\ColdFusion9\solr\lib" or wherever you installed SOLR on your server.

After you set all of this up, I suggest going here on your server:
http://localhost:8983/solr/COLLECTION_NAME/admin/dataimport.jsp

From there, you can do full imports, delta imports, and much more.

Once I explore this a bit more, I will talk about delta imports and some other advanced stuff. It will be interesting to see how much faster all of the information can be indexed using this method.

Sincerely,
Travis Walters
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Database Query Search Time - pmeenan - 07-04-2010, 12:03 PM
RE: Database Query Search Time - pmeenan - 07-05-2010, 04:35 AM
RE: Database Query Search Time - sajal - 07-05-2010, 05:03 AM
RE: Database Query Search Time - pmeenan - 07-08-2010, 08:47 PM
RE: Database Query Search Time - sajal - 08-13-2010, 10:06 PM
RE: Database Query Search Time - sajal - 08-14-2010, 03:38 AM
RE: Database Query Search Time - sajal - 08-14-2010, 06:50 AM
RE: Database Query Search Time - pmeenan - 08-16-2010, 02:55 AM
RE: Database Query Search Time - sajal - 08-17-2010, 01:14 AM
RE: Database Query Search Time - pmeenan - 08-23-2010, 01:22 AM
RE: Database Query Search Time - pmeenan - 08-23-2010, 08:45 PM
RE: Database Query Search Time - ringman57 - 08-24-2010, 11:52 PM
RE: Database Query Search Time - ringman57 - 08-25-2010, 02:54 AM
RE: Database Query Search Time - green-watch.org - 09-28-2010 09:44 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)