Solr 跨多核搜索 [英] Solr Search Across Multiple Cores

查看:65
本文介绍了Solr 跨多核搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 Solr 内核.

I have two Solr cores.

Core0 从名为 items 的 Oracle 表中导入数据.每个项目都有一个唯一的 id (item_id),并且是视频项目或音频项目 (item_type).其他字段包含可搜索文本(说明、评论等)

Core0 imports data from a Oracle table called items. Each item has a unique id (item_id) and is either a video item or a audio item (item_type). Other fields contain searchable texts (description, comments etc)

Core1 从两个名为 video_item_dates 和 audio_item_dates 的表(来自不同的数据库)导入数据,它们记录了特定市场中某个项目的出现日期.这些字段是 item_id、item_market 和日期.单行看起来像 (item_001, 'Europe', '2011/08/15, 2011/08/17,2011/08/20).这两个数据库表中的唯一键是 item_id 和 item_market 的组合.我已将数据展平为 Core1 的单个索引.

Core1 imports data from two tables (from a different database) called video_item_dates and audio_item_dates which record occurrence dates of an item in a specific market. The fields are item_id, item_market and dates. A single row would look like (item_001, 'Europe', '2011/08/15, 2011/08/17,2011/08/20). The unique key in these two database tables here is the combination of item_id and item_market. I have flattened data into a single index for Core1.

我现在的问题是搜索两个内核以产生一个结果.典型的查询类似于在 2011 年 8 月期间在北美市场上有哪些商品在描述字段中带有 Hurricane 一词?".我可以将此查询分成两个不同的查询,并使它们针对不同的核心运行,然后合并结果.但考虑到每个查询可能产生数百万行,这种方法效率很低.

My problem now is searching both cores to produce a single result. A typical query would be like 'What are the items that have the word Hurricane in the description field and ran in North American market during the the month of August 2011?'. I could separate this query into two different queries and make them run against a different core and then merge the results. But given the fact each query may produce millions of rows that approach is very inefficient.

我尝试了 Solr 分布式搜索.我创建了第三个核心(称为 Core2),其中包含来自 Core0 和 Core1 的字段.我向第三个核心添加了一个带有 shards 属性的请求处理程序,如下所示:

I tried the Solr Distributed Search. I created a third core (called Core2) with fields from Core0 and Core1. I added a request handler with shards attribute to the third core like this :

<requestHandler name="shard" class="solr.SearchHandler">
   <lst name="defaults">
      <str name="shards">localhost/solr/core0/,localhost/solr/core1/</str>
    </lst>
</requestHandler>

如果我针对第三个核心运行查询,它会将查询转发给 Core0 和 Core1,由于它们都没有所有字段,因此其中一个报告未定义字段"并且响应是错误的请求错误消息.

If I run a query against this third core, it forwards the query to both Core0 and Core1 and since neither of them have all the fields , one of them reports "undefined field" and the response is a bad request error message.

任何帮助将不胜感激.

请注意,我无法控制数据库表的结构.

Please note I have no control over the structure of the database tables.

推荐答案

这似乎不是多核的情况.您应该考虑设计一个支持所需搜索的单一架构.

This does not seem to be a case for multiple cores. You should look into designing a single schema that supports the desired search.

这篇关于Solr 跨多核搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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