Solr MoreLike这不适用于多个分片?(Solr MoreLikeThis not working for multiple shards?)
我在SolrCloud中有5个节点集群,每个节点有2个分片,
Solr版本:6.3.0
现在,当我运行mlt查询时,它只返回每个节点的结果,并且不会将它们分布在所有分片/节点上,即
没有结果
给出结果,
我甚至尝试将其指定为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
now when I run mlt query it only returns result per node and doesn't distribute them over all shards/nodes, i.e
gives no results while
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
最满意答案
一种方法是@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 anExecutor
or just invokerun()
from the main thread.Another possibility is to always do the same wrapping in a
Runnable
and submit it to an always-givenExecutor
.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 fakeExecutor
, 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.
相关问答
更多-
误解单线程和多线程编程之间的区别(Misunderstanding the difference between single-threading and multi-threading programming)[2022-04-10]
这取决于。 你有多少个cpus? 你的任务涉及多少I / O? 如果您只有1个CPU,并且任务没有阻塞I / O,那么单线程将完成等于或快于多线程,因为切换线程会产生开销。 如果你有1个CPU,但任务涉及很多阻塞I / O,你可能会看到使用线程加速,假设在I / O进行时可以完成工作。 如果你有多个cpus,那么你应该看到单线程的多线程实现的加速,因为多于一个的线程可以并行执行。 除非这些任务是I / O占主导地位,在这种情况下,限制因素是您的设备速度,而不是CPU功耗。 It depends. How m ... -
如何在单线程中使用java实现多线程操作系统?(How should implement multi-thread in single-threaded Operating system using java?)[2022-01-21]
当然你可以做到这一点,但他们会一个接一个地在CPU中处理...... Sure you can do this, but nevertheless they will processed (within the CPU) one after another... -
如何在Rust中的自定义单线程迭代器上并行`映射(...)`?(How to parallely `map(…)` on a custom, single-threaded iterator in Rust?)[2022-03-07]
一般而言,就并行化而言,维护秩序是一项非常艰难的要求。 你可以尝试用一个典型的扇出/扇入设置手工制作: 一个单一的生产者标签输入与顺序单调递增的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 ...
-
是javascript单线程吗?(Is javascript single-threaded?)[2023-06-02]
是否保证在所有浏览器上始终是单线程的? 是。 当然,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 ... -
使用Swing进行多线程处理(Multi-threading with Swing)[2023-10-29]
创建一个包含Collection的RobotModel并定义它们的交互。 在SwingWorker的doInBackground()实现中迭代模型。 当有意义的事件出现时调用publish() ,并通过查询模型对RobotWorld视图进行process()更新。 如此处所讨论的,模型中应该没有绘图,视图中没有交互逻辑。 单个工作人员应该足够适合中等复杂的模型,但您可以同步多个工作人员,如此处所示。 Create a RobotModel that contains a Collection< ... -
Mapper使用多线程?(Mapper using multi-threading?)[2022-03-16]
正如在评论中已经说过的那样,您可能应该重新设计数据库逻辑,以便能够逐页查询数据,在服务器端或客户端使用一些过滤器。 但是,如果您仍然需要转换/转换某些数据,想要在后台执行此操作,并且能够并行化代码,您可以从TPL Dataflow尝试TransformBlock ,如下所示: public class ItemDto { } public class Item { } var transform = new TransformBlock(dto => new Item(), ...