首页 > 解决方案 > 如何提高 Solr 多重 OR 运算的性能

问题描述

给定情况

在 solr 中,我需要做类似的事情

q=(
    menu_name: A OR 
    menu_name: B OR 
    menu_name: C OR
    ... 
)

这需要大量的 OR 操作。

问题

我担心太多的“或”可能会导致性能问题。

我认为如果我可以使用“set”的 IN 操作,我可以提高性能。(不在列表中)由于集合的 IN 操作需要 N(1)。

solr 文档说...(https://solr.apache.org/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-BooleanOperatorsSupportedbytheStandardQueryParser

The OR operator links two terms and finds a matching document if either of the terms exist in a document. This is equivalent to a union using sets.

问题

标签: solr

解决方案


推荐阅读