2012-07-02 125 views
1

我想索引我的數據庫表。如果我在瀏覽器中運行:http://localhost:8983/solr/dataimport?command=full-import返回:索爾索引mysql和搜索

<response> 
    <lst name="responseHeader"> 
     <int name="status">0</int> 
     <int name="QTime">0</int> 
     <lst name="params"> 
      <str name="command">full-import</str> 
     </lst> 
    </lst> 
    <lst name="initArgs"> 
     <lst name="defaults"> 
      <str name="echoParams">explicit</str> 
      <str name="config">data-config.xml</str> 
      <str name="df">text</str> 
     </lst> 
    </lst> 
    <str name="command">full-import</str> 
    <str name="status">idle</str> 
    <str name="importResponse"/> 
    <lst name="statusMessages"> 
     <str name="Total Requests made to DataSource">21</str> 
     <str name="Total Rows Fetched">743</str> 
     <str name="Total Documents Skipped">0</str> 
     <str name="Full Dump Started">2012-07-02 18:52:47</str> 
     <str name="">Indexing completed. Added/Updated: 20 documents. Deleted 0 documents.</str> 
     <str name="Committed">2012-07-02 18:52:57</str> 
     <str name="Total Documents Processed">20</str><str name="Time taken">0:0:9.977</str> 
    </lst> 
    <str name="WARNING">This response format is experimental. It is likely to change in the future.</str> 
</response> 

如果我運行http://localhost:8983/solr/select/?q=pasticceria它返回此錯誤

HTTP錯誤400

問題訪問/ Solr的/選擇/。原因:

路徑

缺少Solr的核心名稱這是我的配置文件:

數據-config.xml中

<dataConfig> 
<dataSource type="JdbcDataSource" 
      driver="com.mysql.jdbc.Driver" 
      url="jdbc:mysql://myhost/mydb" 
      user="myuser" 
      password="mypsw"/> 
<document name="doc"> 
    <entity name="place" query="SELECT * FROM Place"> 
     <field column="id_place" name="id_place" /> 
     <field column="name_place" name="name_place" /> 
    </entity> 
</document> 

的schema.xml

<fields> 

    <field name="id_place" type="string" indexed="true" stored="true" required="true" /> 
    <field name="name_place" type="text_general" indexed="true" stored="true"/> 
    <dynamicField name="*" type="ignored" multiValued="true" /> 
</fields> 

<uniqueKey>id_place</uniqueKey> 
<defaultSearchField>text</defaultSearchField> 
<solrQueryParser defaultOperator="OR"/> 

solrconfig.xml中

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> 
<lst name="defaults"> 
    <str name="echoParams">explicit</str> 
    <str name="config">data-config.xml</str> 
    <str name="df">text</str> 
</lst> 
+0

哇,這是一個很長的單行xml – ZnArK

回答

2

根據你使用多核設置錯誤信息,你需要把核心的網址(想象其所謂CORE0):

http://localhost:8983/solr/core0/select/?q=pasticceria 
+0

如何設置我的核心? – Dany