apache solr响应不返回结果

时间:2013-01-17 08:41:13

标签: postgresql solr

我用我的postgresql数据库连接了apache solr我试图使用这个url检索结果集

 http://localhost:8055/solr/dataimport?command=full-import

这是db-data-config.xml

<dataConfig>
    <dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://myhost:myport/addressbook" user="username"  password="password"/>
      <document>
        <entity name="addressbook" 
            query="select firstname from addressbook where firstname like '%A%'">
             <field name="id" column="id" />
        </entity>
      </document>
</dataConfig>
我得到了回应。但我在这里看不到结果行。

  <?xml version="1.0" encoding="UTF-8" ?> 
- <response>
- <lst name="responseHeader">
  <int name="status">0</int> 
  <int name="QTime">0</int> 
  </lst>
- <lst name="initArgs">
- <lst name="defaults">
  <str name="config">db-data-config.xml</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">1</str> 
  <str name="Total Rows Fetched">11</str> 
  <str name="Total Documents Skipped">0</str> 
  <str name="Full Dump Started">2013-01-17 00:29:26</str> 
  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.</str> 
  <str name="Committed">2013-01-17 00:29:27</str> 
  <str name="Total Documents Processed">0</str> 
  <str name="Time taken">0:0:1.343</str> 
  </lst>
  <str name="WARNING">This response format is experimental. It is likely to change in the future.</str> 

我应该在db-data-config.xml中做些什么更改来获取结果行。请帮忙吗?

1 个答案:

答案 0 :(得分:1)

我认为你的查询应该是:

  • 从地址簿中选择* [STAR] ,其中firstname如'%A%'

或至少

  • 从地址簿中选择 id ,其中firstname如'%A%'

目前,您似乎选择名字,然后尝试映射 ID 。那里没有重叠,所以你得到空条目。