如何使用单个solr实例索引和搜索位于同一数据源中的两个不同的表(两个不同的搜索字段没有连接) [英] How to index and search two different tables which are in same datasource using single solr instance(two different search fields no joins)

查看:122
本文介绍了如何使用单个solr实例索引和搜索位于同一数据源中的两个不同的表(两个不同的搜索字段没有连接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是solr的新手。我有几个关于solr索引和搜索的问题:

I am new to solr. I have couple of questions on solr Indexing and searching:


  1. 我可以配置索引两个表(没有关系1.书籍和2.计算机如果我想要两个搜索框,则两者都在同一个数据源中。是否可以在一个data-config.xml中定义两个实体?

如果是,请告诉我相应的步骤。

If yes please let me know the steps.

我想我们可以使用两个不同的data-config.xml文件。但需要知道如何在schema.xml中配置和相应的更改。

I guess we can do using two different data-config.xml files. But need to know how to configure in schema.xml and corresponding changes.


  1. 如何配置solr以索引PDF一个solr实例上的文件和Mysql。

请帮助我,让我们知道是否有参考文件。

Please help me out and let know if there are any reference documents.

推荐答案

2个不同的表无关系

data-config.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>

schema.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/

不需要以上字段,也可能在编制索引时产生问题

no above field should be required or may create problem while indexing

您可以查询浏览器如 http:// localhost:8080 / solr / select /?q = *:*& fq = doc_type:PRODUCT

这篇关于如何使用单个solr实例索引和搜索位于同一数据源中的两个不同的表(两个不同的搜索字段没有连接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆