我是 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/