1

我想索引我的数据库表。如果我在浏览器中运行:http://localhost:8983/solr/dataimport?command=full-import它会返回:

<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/select/ 时出现问题。原因:

路径中缺少 solr 核心名称

这是我的配置文件:

数据配置.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>

架构.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>
4

1 回答 1

2

根据您正在使用多核设置的错误消息,您需要将核心放在 url 中(想象它称为 core0):

http://localhost:8983/solr/core0/select/?q=pasticceria
于 2012-07-02T19:20:43.323 回答