2016-02-28 70 views
0

Solr的MySQL的反應是不妥當的 正在使用的Solr 5.5.0 這是我的代碼Solr的5.5.0響應不正確

<dataconfig> 
    <datasource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbname" user="user" password="password"/> 
    <document name="user"> 
    <entity name="user" query="select * from user"> 
    <field column="id" name="id"/> 
    <field column="name" name="name"/> 
    </entity> 
    </document> 
</dataconfig> 

的schema.xml模式文件 ,我檢索ID和名稱索引

<field column="name" name="name" indexed="true" stored="true"/> 
    <field column="id" indexed="true" stored="true" name="id"/> 

我的輸出

 "responseHeader": { 
     "status": 0, 
     "QTime": 5, 
     "params": { 
     "q": "*:*", 
     "indent": "true", 
     "wt": "json", 
     "_": "1456634392166" 
     } 
     }, 
     "response": { 
     "numFound": 38, 
     "start": 0, 
     "docs": [ 
     { 
     "id": "1", 
     "_version_": 1527391572777238500 
     } 

numFoundid是正確的name不來了。

+0

dataconfig>

回答

0

該響應返回參數fl中指定的字段。

只需將fl=id,name附加到您的查詢。

+0

F1 = ID,名字無法得到名 「文檔」:[ { 「ID」: 「1」 }, –

+0

使用FL(佛羅里達州小大寫字母)不F1 (f one) –

+0

http:// ipaddress:8983/solr/gettingstarted/select?q = *%3A *&fl = id%2Cname&wt = json&indent = true –