首页 \ 问答 \ 使用solr作为有序聚合系统(Use solr as an ordered aggregate system)

使用solr作为有序聚合系统(Use solr as an ordered aggregate system)

我需要开发一个系统,显示不同类型的“内容块”。 首先,我有三个系统提供数据块(其中一个是博客,另一个是事件列表,第三个是定制的)。 这可能会在以后的项目中得到扩展。

这个想法是有一个很长的列表,首先在发布日期排序(按时间顺序排列)。 但是,某些类型可能具有更高的优先级,因此例如,事件在列表中显示的相对高于具有因子x博客帖子。

然后我需要一些额外的排序,比如博客文章可能是“特色”,所以他们也给予了更多的优先级,比如因子y 。 最后一件事是内容块可能被标记为“粘性”,因此它们始终位于列表的顶部。

由于solr背后的先进技术和所有查询选项,我当时正在考虑使用solr作为此列表块的引擎。 这样的事情是可能的,还是另一种更适合这种技术?

我对solr的偏好也是因为将新内容注入索引会相对容易。 但是我必须定义一个查询来返回按日期排序的完整(分页)索引,这也是我必须要弄清楚的。

最后一点:应用程序将是一个php(Zend Framework 2)项目,所以它更好,它必须直接使用php或为php编写的客户端(例如SolrClient for solr)。 把它作为一个问题来形容:对于上述要求可能是一项好的技术,对于这个问题来说,这是一个好的技术吗?


I need to develop a system where different kind of "content blocks" are displayed. First I have three systems delivering blocks of data (one of them is a blog, another one a listing of events, a third one something custom). This might get extended later on in the project.

The idea is to have a long list, ordered at first on published date (so chronologically). However, some types might have a little bit more priority, so for example events are showed relatively higher in the list than blog posts with a factor x.

Then I need some additional sorting, like blog articles might be "featured" so they are also given a bit more priority, say a factor y. The last thing is content blocks might be marked "sticky" so they keep at the top of the list all the time.

Because of the advanced technology behind solr and all the query options, I was thinking to use solr as an engine for this listing of blocks. Is something like that possible, or is another technology more suitable for this?

My preference for solr is also because it would be relatively easy to inject new content into the index. But how I have to define a query to return the complete (paginated) index sorted by date is something I have to figure out as well.

As a last point: the application will be a php (Zend Framework 2) project so preferable it must work directly with php or by a client written for php (eg, SolrClient for solr). To formulate it as a question: what might be a good technology for above described requirements and is solr a good one for this?


原文:https://stackoverflow.com/questions/13634433
更新时间:2023-10-25 13:10

最满意答案

没什么 。 如果您在缓存的RDD上调用cache ,则什么都不会发生,RDD将被缓存(一次)。 像许多其他转换一样,缓存是懒惰的:

  • 调用cache ,RDD的MEMORY_ONLY设置为MEMORY_ONLY
  • 当你再次调用cache时,它被设置为相同的值(不变)
  • 经过评估,当基础RDD被实现时,Spark将检查RDD的storageLevel ,如果需要缓存,它将缓存它。

所以你很安全。


Nothing. If you call cache on a cached RDD, nothing happens, RDD will be cached (once). Caching, like many other transformations, is lazy:

  • When you call cache, the RDD's storageLevel is set to MEMORY_ONLY
  • When you call cache again, it's set to the same value (no change)
  • Upon evaluation, when underlying RDD is materialized, Spark will check the RDD's storageLevel and if it requires caching, it will cache it.

So you're safe.

相关问答

更多
  • RDDs不能代替Python列表。 您必须使用给定RDD上可用的操作或转换。 在这里你可以简单地使用map : from pyspark.mllib.linalg import DenseVector from pyspark.mllib.regression import LabeledPoint feature_matrix_vectors = sc.parallelize([ DenseVector([1.0, 31.0, 5.0, 1935.0, 24.0]), DenseVec ...
  • 它存储在内存中吗? 当你通过一个动作 ( count , print , foreach )运行一个spark变换,然后,只有这样你的图形才会被实现,在你的情况下,文件正被消耗。 RDD.cache旨在确保sc.textFile("testfile.csv")的结果在内存中可用,并且不需要再次读取。 不要将变量与幕后执行的实际操作混淆。 缓存允许您重新迭代数据,确保它在内存中(如果有足够的内存将其全部存储在其中)如果您想重新迭代所述RDD,并且只要您设置了正确的数据存储级别 (默认为StorageLevel ...
  • 没什么 。 如果您在缓存的RDD上调用cache ,则什么都不会发生,RDD将被缓存(一次)。 像许多其他转换一样,缓存是懒惰的: 调用cache ,RDD的MEMORY_ONLY设置为MEMORY_ONLY 当你再次调用cache时,它被设置为相同的值(不变) 经过评估,当基础RDD被实现时,Spark将检查RDD的storageLevel ,如果需要缓存,它将缓存它。 所以你很安全。 Nothing. If you call cache on a cached RDD, nothing happens, ...
  • 当调用RDD上的cache()时,RDD的状态是否发生了变化(并且返回的RDD就是为了便于使用)或者创建一个新的RDD,将现有的RDD 返回相同的RDD : /** * Mark this RDD for persisting using the specified level. * * @param newLevel the target storage level * @param allowOverride whether to override any existing level with ...
  • 主观原因列表: 在实践中缓存很少需要,并且主要用于迭代算法,打破长期血统。 例如,典型的ETL管道可能根本不需要缓存。 缓存大部分RDD肯定不是正确的选择。 没有通用的缓存策略。 实际选择取决于可用资源,如内存量,磁盘(本地,远程,存储服务),文件系统(内存,磁盘)和特定应用程序。 磁盘上的持久性代价很高,在内存中,持久性会给JVM带来更多的压力,并且正在使用Spark中最宝贵的资源 无需对应用程序语义进行假设就可以自动缓存。 尤其是: 数据源更改时的预期行为。 没有普遍的答案,并且在许多情况下,自动跟踪更 ...
  • 直接你不能做到这一点。 但是,有几个解决方案可以帮助你。 作为@ morfious902002提到你可以使用Alluxio(但你需要将它安装到你的群集上),它提供了一种分层存储(memory / hdfs / s3)。 另一种选择是使用spark-jobserver或持有相同spark的上下文,并通过REST API将您的作业提交给此服务器。 由于所有工作都将在相同的长期生活环境下执行,因此您可以在作业之间共享RDD。 Directly you can't achieve this. However the ...
  • 可以使用Spark REST API ,它提供两个端点: /applications/[app-id]/storage/rdd - 所有存储的RDD列表。 /applications/[app-id]/storage/rdd/[rdd-id] - 特定RDD的详细信息。 It is possible to use Spark REST API which provides two endpoints: /applications/[app-id]/storage/rdd - list of all stor ...
  • 如果您阅读Spark编程指南 ,您将找到第一个问题的答案: 为了说明RDD基础知识,请考虑以下简单程序: val lines = sc.textFile("data.txt") val lineLengths = lines.map(s => s.length) val totalLength = lineLengths.reduce((a, b) => a + b) 第一行从外部文件定义基础RDD。 此数据集未加载到内存中或以其他方式操作:行仅仅是指向文件的指针。 第二行将lineLengths定义为地 ...
  • RDD沿袭被构建为链接在一起的RDD对象实例的图形,其中沿袭的每个节点都具有对其依赖性的引用。 在它最简单的链表单中,您可以将其视为链接列表: hadoopRDD(location) <-depends- filteredRDD(f:A->Boolean) <-depends- mappedRDD(f:A->B) 您可以在基本RDD构造函数中理解这一点: /** Construct an RDD with just a one-to-one dependency on one parent */ de ...
  • 您可能已经意识到,Spark使用LRU算法管理持久化的RDD。 虽然您没有添加更多数据,但Spark完全有可能删除这些RDD,因为它们已经超出Spark应用程序(作业)的范围,或者只是“太旧”。 缓存RDD的生命周期由TimeStampedWeakValueHashMap管理。 基本上,如果RDD的时间戳早于特定阈值,则在调用clearOldValues()时将删除RDD。 你回答暗示你想确保这些RDD没有被删除,所以你可能想看看将你的Spark数据直接保存到Cassandra,因为它们很好地一起玩。 As ...

相关文章

更多

最新问答

更多
  • 您如何使用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)