postgresql - Apache Solr DataImport 成功,但没有查询结果

标签 postgresql solr dataimporthandler

我是 solr 的新手,正在尝试使用 solr 6.5.1 + postgresql 索引数据库。

最后看起来索引数据库成功了。

DataImport 屏幕显示

Indexing completed. Added/Updated: 0 documents. Deleted 0 documents. (Duration: 21m 13s)
Requests: 1 , Fetched: 19,736,915 15,504/s, Skipped: 0 , Processed: 0 
Started: about an hour ago

However nothing is showing on Query screen when I pressed "Execute Query" button.

{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
  "q":"*:*",
  "indent":"on",
  "wt":"json",
  "_":"1497333923963"}},
  "response":{"numFound":0,"start":0,"docs":[]
}}

我的数据库配置 (db-data-config.xml) 如下所示。

 <dataConfig>
   <dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://xxx.xx.xxx.xx:5432/xxxxx" user="xxxxx" password="xxx" />
   <document>
     <entity name="pubmed" query="select pmid, article_title, abstract from pubmed_xml">
        <field column="pmid" name="pmid" />
        <field column="article_title" name="article_title" />
        <field column="abstract" name="abstract" />
     </entity>
   </document>
</dataConfig>

你们能给我一些解决这个问题的提示吗?

提前谢谢你。

最佳答案

如果检查 schema.xml 文件,您将看到如下条目:<uniqueKey>id</uniqueKey> .这定义了 solr 字段 id是索引中所有文档所必需的唯一字段。如果您想使用不同的字段,请更改 uniqueKey 条目并确保该特定字段(在您的情况下为 pmid)已在架构中定义。

关于postgresql - Apache Solr DataImport 成功,但没有查询结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44515459/

相关文章:

java - 如何在注解@CreatedDate 中设置默认日期?

在 Solr/Lucene 中记录搜索关键字

mysql - 为电子商务网站编写 SOLR 搜索查询的最佳实践是什么

unix - Solr DataImportHandler 清算索引

database - 在 solr 中执行增量导入时的时间戳兼容性

mysql - 索引失败。回滚所有更改。 (Solr 数据导入)

java - 具有相似模式的 Spring 多数据源

postgresql - Postgres 查询 : array_to_string with empty values

ruby-on-rails - 带有嵌套表的 ActiveRecord 查询

solr - 如何将树数据存储在 Lucene/Solr/Elasticsearch 索引或 NoSQL 数据库中?