首页 \ 问答 \ Solr MoreLike这不适用于多个分片?(Solr MoreLikeThis not working for multiple shards?)

Solr MoreLike这不适用于多个分片?(Solr MoreLikeThis not working for multiple shards?)

我在SolrCloud中有5个节点集群,每个节点有2个分片,

Solr版本:6.3.0

在此处输入图像描述

现在,当我运行mlt查询时,它只返回每个节点的结果,并且不会将它们分布在所有分片/节点上,即

http://10.0.1.15:8983/solr/test_ingest/mlt?q=advertising_id%w72w9424620427042&fl=score&fl=advertising_id&mlt.fl=channel_name&mlt.fl=show_name&mlt.fl=language&mlt.mindf=1

没有结果

http://10.0.1.119:8983/solr/test_ingest/mlt?q=advertising_id%w72w9424620427042&fl=score&fl=advertising_id&mlt.fl=channel_name&mlt.fl=show_name&mlt.fl=language&mlt.mindf=1

给出结果,

我甚至尝试将其指定为param:

碎片= 10.0.1.84:8983 / solr的/ test_ingest_shard3_replica1,10.0.1.84:8983 / solr的/ test_ingest_shard8_replica1,10.0.1.206:8983 / solr的/ test_ingest_shard2_replica1,10.0.1.206:8983 / solr的/ test_ingest_shard7_replica1,10.0.1.15:8983 / solr的/ test_ingest_shard5_replica1,10.0.1.15:8983 / solr的/ test_ingest_shard10_replica1,10.0.1.207:8983 / solr的/ test_ingest_shard1_replica1,10.0.1.207:8983 / solr的/ test_ingest_shard6_replica1,10.0.1.119:8983 / solr的/ test_ingest_shard9_replica1,10.0.1.119:8983 / solr的/ test_ingest_shard4_replica1

我的请求处理程序

 <requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
 </requestHandler>

如何配置mlt以运行分布式搜索? 谢谢


I have 5 node cluster in SolrCloud, with 2 shards per node,

Solr version:6.3.0

enter image description here

now when I run mlt query it only returns result per node and doesn't distribute them over all shards/nodes, i.e

http://10.0.1.15:8983/solr/test_ingest/mlt?q=advertising_id%w72w9424620427042&fl=score&fl=advertising_id&mlt.fl=channel_name&mlt.fl=show_name&mlt.fl=language&mlt.mindf=1

gives no results while

http://10.0.1.119:8983/solr/test_ingest/mlt?q=advertising_id%w72w9424620427042&fl=score&fl=advertising_id&mlt.fl=channel_name&mlt.fl=show_name&mlt.fl=language&mlt.mindf=1

gives results,

I have even tried specifying this as param:

shards=10.0.1.84:8983/solr/test_ingest_shard3_replica1,10.0.1.84:8983/solr/test_ingest_shard8_replica1,10.0.1.206:8983/solr/test_ingest_shard2_replica1,10.0.1.206:8983/solr/test_ingest_shard7_replica1,10.0.1.15:8983/solr/test_ingest_shard5_replica1,10.0.1.15:8983/solr/test_ingest_shard10_replica1,10.0.1.207:8983/solr/test_ingest_shard1_replica1,10.0.1.207:8983/solr/test_ingest_shard6_replica1,10.0.1.119:8983/solr/test_ingest_shard9_replica1,10.0.1.119:8983/solr/test_ingest_shard4_replica1

My request handler:

 <requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
 </requestHandler>

How do I configure mlt to run a distributed search? Thanks


原文:https://stackoverflow.com/questions/43390064
更新时间:2024-05-16 06:05

最满意答案

一种方法是@Victor Sorokin在他的回答中提出:将每个文件的处理封装在Runnable ,然后提交给Executor或仅从主线程调用run()

另一种可能性是始终Runnable执行相同的包装并将其提交给始终给定的 Executor

每个文件的处理是否同时执行取决于给定的Executor的实现。

对于并行处理,您可以调用传递它的函数,即ThreadPoolExecutor作为参数,而对于顺序处理,您可以传入一个伪Executor ,即在调用程序线程中运行提交的任务的执行程序:

public class FakeExecutor implements Executor {

    @Override
    public void execute(Runnable task) {
        task.run();
    }
}

我相信这种方式是最灵活的方法。


One way is as @Victor Sorokin suggests in his answer: wrap the processing of every file in a Runnable and then either submit to an Executor or just invoke run() from the main thread.

Another possibility is to always do the same wrapping in a Runnable and submit it to an always-given Executor.

Whether processing of each file is executed concurrently or not would depend on the given Executor's implementation.

For parallel processing, you could invoke your function passing it i.e. a ThreadPoolExecutor as an argument, whereas for sequential processing you could pass in a fake Executor, i.e. one that runs submitted tasks in the caller thread:

public class FakeExecutor implements Executor {

    @Override
    public void execute(Runnable task) {
        task.run();
    }
}

I believe this way is the most flexible approach.

相关问答

更多
  • 这取决于。 你有多少个cpus? 你的任务涉及多少I / O? 如果您只有1个CPU,并且任务没有阻塞I / O,那么单线程将完成等于或快于多线程,因为切换线程会产生开销。 如果你有1个CPU,但任务涉及很多阻塞I / O,你可能会看到使用线程加速,假设在I / O进行时可以完成工作。 如果你有多个cpus,那么你应该看到单线程的多线程实现的加速,因为多于一个的线程可以并行执行。 除非这些任务是I / O占主导地位,在这种情况下,限制因素是您的设备速度,而不是CPU功耗。 It depends. How m ...
  • 当然你可以做到这一点,但他们会一个接一个地在CPU中处理...... Sure you can do this, but nevertheless they will processed (within the CPU) one after another...
  • 一般而言,就并行化而言,维护秩序是一项非常艰难的要求。 你可以尝试用一个典型的扇出/扇入设置手工制作: 一个单一的生产者标签输入与顺序单调递增的ID, 线程池从该生产者消耗,然后将结果发送给最终消费者, 消费者对结果进行缓冲和重新排序以便按顺序对待他们。 或者你可以提高抽象层次。 这里特别感兴趣的是: Future 。 Future表示计算结果,可能发生或可能没有发生。 接收Future的有序列表的消费者可以简单地等待每个列表,并让缓冲在队列中自然发生。 对于奖励积分,如果您使用固定大小的队列,您会自动获得 ...
  • 那么这取决于你如何定义并发。 在服务器端软件中,并发和并行通常被认为是不同的概念。 在服务器中,支持并发I / O意味着服务器能够通过仅使用一个计算单元执行与那些客户端相对应的几个流来为多个客户端服务。 在这种情况下,并行性将意味着服务器能够同时执行几件事情(具有多个计算单元),这是不同的。 例如,一个调酒师能够照顾几个客户,而他一次只能准备一杯饮料。 所以他可以提供没有并行性的并发。 这个问题已经在这里辩论: 并发vs并行性 - 有什么区别? 另见Rob Pike的演讲 。 单线程程序可以通过使用I / ...
  • 一种方法是@Victor Sorokin在他的回答中提出:将每个文件的处理封装在Runnable ,然后提交给Executor或仅从主线程调用run() 。 另一种可能性是始终在Runnable执行相同的包装并将其提交给始终给定的 Executor 。 每个文件的处理是否同时执行取决于给定的Executor的实现。 对于并行处理,您可以调用传递它的函数,即ThreadPoolExecutor作为参数,而对于顺序处理,您可以传入一个伪Executor ,即在调用程序线程中运行提交的任务的执行程序: publi ...
  • Haskell多线程的状态是什么? 成熟。 实施年龄约15岁,交易记录5年。 GHC是广泛使用的编译器,具有大量的开源支持和商业支持。 如何简单的引入到程序中? 这取决于算法。 有时它可以是一行使用par来获得并行性。 有时候必须开发新的算法。 一般来说,在Haskell中引入安全的并行和并发将比在典型的语言中更容易,性能也是好的。 有没有一个很好的多线程教程,通过这些不同的命令及其用途? Haskell有3个主要的并行和并发编程模型。 通过par 通过forkIO / MVars和软件事务内存显式并发和并 ...
  • 您正在使用古老的编译器。 企业无需建立这样的标准,供应商已经做到了这一点。 微软过去13年没有发布CRT的单线程版本。 同样,Windows在过去17年一直是Unicode操作系统。 目前仍然编写Unicode不可知代码毫无意义。 但是,是的,常见的约定是为库的调试版本添加“d”。 给一个库的DLL版本一个完全不同的名字。 You are using an ancient compiler. There is no need to establish such a standard in an enterp ...
  • 是否保证在所有浏览器上始终是单线程的? 是。 当然,HTTP请求之类的东西可能在幕后的不同线程中工作,但是当你的Javascript代码被执行时,它一次只能从一个线程发生。 is it guaranteed to be always single-threaded on all browsers? Yes. Of course, things like HTTP requests might work in different threads behind the scenes, but when your ...
  • 创建一个包含Collection的RobotModel并定义它们的交互。 在SwingWorker的doInBackground()实现中迭代模型。 当有意义的事件出现时调用publish() ,并通过查询模型对RobotWorld视图进行process()更新。 如此处所讨论的,模型中应该没有绘图,视图中没有交互逻辑。 单个工作人员应该足够适合中等复杂的模型,但您可以同步多个工作人员,如此处所示。 Create a RobotModel that contains a Collection< ...
  • 正如在评论中已经说过的那样,您可能应该重新设计数据库逻辑,以便能够逐页查询数据,在服务器端或客户端使用一些过滤器。 但是,如果您仍然需要转换/转换某些数据,想要在后台执行此操作,并且能够并行化代码,您可以从TPL Dataflow尝试TransformBlock ,如下所示: public class ItemDto { } public class Item { } var transform = new TransformBlock(dto => new Item(), ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)