我是 solr 的新手。我有几个关于 solr 索引和搜索的问题:
- 如果我想要有两个搜索框,我可以配置索引两个表(没有关系 1. 书籍和 2. 计算机,并且两者都在同一数据源中)。是否可以执行诸如在一个 data-config.xml 中定义两个实体之类的操作
如果是,请告诉我步骤。
我想我们可以使用两个不同的 data-config.xml 文件。但需要知道如何在schema.xml中进行配置以及相应的更改。
- 如何配置 solr 以在一个 solr 实例上索引 PDF 文件和 Mysql。
请帮帮我,并告知是否有任何参考文件。
2个不同的表没有关系
数据配置.xml:
<document>
<entity name="topic" transformer="TemplateTransformer" pk="topic_id" query="select topic_id,topic_title,creation_date,updation_date,vote_count,.....">
<field column=" doc_id " template="TOPIC_${topic.topic_id} " />
<field column="doc_type " template="TOPIC " />
</entity>
<entity name="product " transformer="TemplateTransformer " pk="product_id " query="SELECT product_id,..... ">
<field column="doc_id " template="PRODUCT_${product.product_id} " />
<field column="doc_type " template="PRODUCT " />
<field column="product_supplier_id " name="product_supplier_id " />
<field column="supplier_product_code " name="supplier_product_code " />
<field column="product_display_name " name="product_display_name " />
</entity>
</document>
架构.xml:
<schema>
. . .
<fields>
<field name="doc_id" type="string" />
<field name="doc_type" type="string" />
<field name="catchall" type="string" stored="false" omitNorms="true" multiValued="true" />
<field name="topic_title" type="text_general" />. . . .
</fields>
<uniqueKey>doc_id</uniqueKey>
<copyField source="*" dest="catchall" />
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>catchall</defaultSearchField>
</schema>
更多信息 -http://www.lucidimagination.com/blog/2011/02/12/solr-powered-isfdb-part-4/ http://www.lucidimagination.com/blog/2011/02/12/solr-powered-isfdb-part-4/
不应要求上述字段,否则可能会在索引时产生问题
你可以在浏览器上查询http://localhost:8080/solr/select/?q=*:*&fq=doc_type:PRODUCT
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)