2

我对 Solr 很陌生。在提出这个问题之前,我已经阅读了这篇文章(需要帮助使用 DataImportHandler 将 XML 文件索引到 Solr 中)。但是它没有帮助,因为我对 Apache Solr 很陌生。我正在寻找一个 xml 文件的索引并搜索它的内容。它的结构类似于这样

<entry id="REACT_142474" acc="REACT_142474.5">
<name>((1,6)-alpha-glucosyl)poly((1,4)-alpha-glucosyl)glycogenin =&gt; poly{(1,4)-alpha-      glucosyl} glycogenin + alpha-D-glucose</name>
<description>This event has been computationally inferred from an event that has been demonstrated in another species.The inference is based on the homology mapping in Ensembl Compara. Briefly, reactions for which all involved PhysicalEntities (in input, output and catalyst) have a mapped orthologue/paralogue (for complexes at least 75% of components must have a mapping) are inferred to the other species. High level events are also inferred for these events to allow for easier navigation.More details and caveats of the event inference in Reactome. For details on the Ensembl Compara system see also: Gene orthology/paralogy prediction method.</description>
<dates>
<date type="creation" value="06-JUN-2013"/>
<date type="last_modification" value="06-JUN-2013"/>
</dates>
<cross_references>
<ref dbname="ChEBI" dbkey="17925"/>
<ref dbname="UniProt" dbkey="Q06625"/>
<ref dbname="ChEBI" dbkey="18291"/>
<ref dbname="UniProt" dbkey="P47011"/>
<ref dbname="UniProt" dbkey="P36143"/>
<ref dbname="GO" dbkey="GO:0004135"/>
<ref dbname="taxonomy" dbkey="4932"/>
</cross_references>
<additional_fields>
<field name="organism">Saccharomyces cerevisiae</field>
</additional_fields>
</entry>

是否必须使用 DIH 将此数据导入 Solr?没有更简单的方法来完成任务吗?可以通过 SolrJ 完成吗,因为我也可以通过控制台输出结果。除了官方文档之外,如果有人可以向我指出一些有用的示例或资源,那将非常有帮助。

4

2 回答 2

4

以下是使用 Solrj 解析并索引 XML 文件的常规示例:

于 2013-08-14T23:56:13.100 回答
-1

我使用您发布的链接对我自己的数据使用 XPathEntityProcessor。当时我是新手,但并不难。

如果您想使用 SolrJ,请查看此链接以获取示例。我假设您可以使用任何您想要的 XML 解析器来解析您的 XML,然后使用 SolrJ 将新文档添加到您的索引中。

于 2013-08-22T14:14:36.140 回答