IBM Watson - 检索和排名:如何判断 PDF 文档中的文本应被视为一个字段?

IBM Watson - Retrieve and Rank: How to tell that a text in a PDF document should be considered a field?

我正在 Retrieve and Rank 服务中加载大量 PDF 文档,但我不知道要告诉 Solr 或 IBM Retrieve and Rank 服务我的 PDF 文档的特定部分应该被视为一个字段供以后查询,例如名称或文档进程 ID。

使用 web-based UI 上传文档时不能这样做,因为这只会填充一些默认字段,例如 body 和标题。

但是您可以通过编程方式将 PDF 文档的内容添加到 R&R collection。当您这样做时,您可以随意添加任何您想要的字段。

例如来自 https://www.ibm.com/watson/developercloud/retrieve-and-rank/api/v1/?java#index_doc

的文档
RetrieveAndRank service = new RetrieveAndRank();
service.setUsernameAndPassword("{username}","{password}");

SolrInputDocument newdoc = new SolrInputDocument();
document.addField("id", 1);
document.addField("author", "brenckman,m.");
document.addField("bibliography", "j. ae. scs. 25, 1958, 324.");
etc... 

UpdateResponse addResponse = solrClient.add("example_collection", newdoc);

solrClient.commit("example_collection");

与此示例使用 authorbibliography 作为附加字段名称的方式相同,您可以添加新的字段名称,例如进程 ID。

您需要更新 R&R 的架构 collection 以指定这些新字段。您可以使用 https://github.com/IBM-Watson/kale/blob/master/solr/knowledge-expansion-en.xml#L36 处的架构作为示例,了解如何指定其他字段。