1

我用我的 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 中进行哪些更改才能在此处获取结果行。请帮忙?

4

1 回答 1

1

我认为您的查询应该是:

  • select * [STAR] from addressbook where firstname like '%A%'

或者至少

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

目前,您似乎在选择firstname但随后尝试映射id。那里没有重叠,所以你得到空条目。

于 2013-01-17T13:13:35.403 回答