3

Configuring my solr server, am able to start and stop the server and can see the dashboard etc.

Just created a core called "Wish". So in the wish folder of the server I added the data source details in solrconfig.xml

Here is the essential part of it

 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
      <lst name="datasource">
         <str name="driver">com.mysql.jdbc.Driver</str>
         <str name="url">jdbc:mysql://localhost:3306/wish</str> //db name wish 
         <str name="user">root</str>
         <str name="password"></str>
      </lst>
    </lst>
  </requestHandler>

And the data config xml file content id

<dataConfig>
<dataSource type="JdbcDataSource" 
            driver="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/wish" 
            user="root" 
            password=""/>
 <document name="retailer">
        <entity name="retailer" query="select * from retailer"></entity>
</document>
</dataConfig>

If you look at it I am just trying to add an entitiy retailer and my retailer table consists of 2 rows so far. But when I invoke the solr API request like below, nothing showing :(

Here is the API request

http://localhost:8983/solr/wish/select?q=*:*

but always the result is

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="q">*:*</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>

Is something is wrong my config ? or the way I am invoking it wrong ?

Any clues and help will be much appreciated. Thanks in advance.

Lefty G Balogh
  • 1,771
  • 3
  • 26
  • 40
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • @Suresh: have you done with indexing...? using dataimport?also have you done any configurations about the fields in your managed-schema or schema.xml..? – Abhijit Bashetti Oct 10 '16 at 06:02
  • the api you are using is for search...if you have not done data-import..you wont be able to use search...as there is nothing been indexed to search...you can use the solr analysis page as well..can be accesses using http://localhost:8983/solr/ – Abhijit Bashetti Oct 10 '16 at 06:06
  • @AbhijitBashetti Thankyou so much that you responded. I just dont know what to write in schema.xml. :( I just want to get the data from retailer table. what to write in schema.xml ? can you please help me ? – Suresh Atta Oct 10 '16 at 06:35
  • yes... will prove you some links which will resolve your issue..https://cwiki.apache.org/confluence/display/solr/Dataimport+Screen... – Abhijit Bashetti Oct 10 '16 at 06:38
  • https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler – Abhijit Bashetti Oct 10 '16 at 06:41
  • http://stackoverflow.com/questions/10343756/how-to-use-the-solr-data-import-handler-to-index-a-mysql-table – Abhijit Bashetti Oct 10 '16 at 08:14

0 Answers0