1
votes

I'm new at solr and trying to index database with solr 6.5.1 + postgresql.

Finally it looks successful to index the database.

DataImport screen shows

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":[]
}}

my database configuration (db-data-config.xml) is like as below.

 <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>

Could you guys give me some tips for fixing this issue ?

Thank you in advance.

2

2 Answers

0
votes

Anyway, I found the solution to fix it.

I changed the name 'pmid' to 'id' like this.

and it works fine. It seems that 'id' is used as indexing key inside solr configuration.

please let me know whoever knows the reason.

thank you.

0
votes

If you check your schema.xml file, you'll see an entry as follows: <uniqueKey>id</uniqueKey>. This defines the solr field id to be the unique field which is mandatory for all documents in the index. In case you want to use a different field, change the uniqueKey entry and ensure that that particular field (pmid in your case) is defined in the schema.