matching 模块

匹配器

class whoosh.matching.Matcher

所有匹配者的基类。

all_ids()

返回匹配器中所有ID的生成器。

对于已经读取了一些日志(无论只生成剩余的日志还是从开始的所有日志)的匹配器,此方法返回的内容是未定义的,因此最好只在新的匹配器上使用此方法。

all_items()

返回匹配器中所有(ID、编码值)对的生成器。

对于已经读取了一些日志(无论只生成剩余的日志还是从开始的所有日志)的匹配器,此方法返回的内容是未定义的,因此最好只在新的匹配器上使用此方法。

block_quality()

根据当前加权算法,返回当前发布块的质量度量。加薪 NoQualityAvailable 如果匹配器或权重不支持质量测量。

children()

返回此匹配器的子匹配器的列表(可能为空)。

abstract copy()

返回此匹配器的副本。

depth()

返回此匹配器下树的深度,如果此匹配器没有任何子级,则返回0。

abstract id()

返回当前过帐的ID。

abstract is_active()

如果此匹配器仍处于“活动”状态,则返回“真”,也就是说,它尚未到达发布列表的结尾。

items_as(astype)

返回匹配器中所有(ID,解码值)对的生成器。

对于已经读取了一些日志(无论只生成剩余的日志还是从开始的所有日志)的匹配器,此方法返回的内容是未定义的,因此最好只在新的匹配器上使用此方法。

matching_terms(id=None)

返回的迭代器 ("fieldname", "termtext") 元组为 currently matching 在这棵树上称火柴人。

max_quality()

根据当前的加权算法,返回此匹配器的最大可能质量度量。加薪 NoQualityAvailable 如果匹配器或权重不支持质量测量。

abstract next()

将此匹配器移动到下一个日志。

replace(minquality=0)

返回此匹配器的可能简化版本。例如,如果unionmatcher的一个子级不再活动,则对unionmatcher调用此方法将返回另一个子级。

abstract reset()

返回到发布列表的开头。

请注意,reset()可能不会在调用后执行预期的操作。 Matcher.replace() ,因为这可能意味着调用reset()不是在原始匹配器上,而是在优化的替换上。

abstract score()

返回当前过账的分数。

skip_to(id)

将此匹配器移动到ID等于或大于给定ID的第一个日志。

skip_to_quality(minquality)

将此匹配器移动到下一个大于给定的最小质量值的块。

spans()

返回的列表 Span 此文档中匹配项的对象。如果要搜索的字段不存储位置,则引发异常。

abstract supports(astype)

Returns True if the field's format supports the named data type, for example 'frequency' or 'characters'.

supports_block_quality()

如果此匹配器支持使用 qualityblock_quality .

term()

返回A ("fieldname", "termtext") 此匹配器匹配的术语的元组,如果此匹配器不是术语匹配器,则为无。

term_matchers()

返回此树中术语匹配器的迭代器。

abstract value()

返回当前过帐的编码值。

abstract value_as(astype)

返回当前过帐的值作为给定类型。

weight()

返回当前过帐的权重。

whoosh.matching.NullMatcher
class whoosh.matching.ListMatcher(ids, weights=None, values=None, format=None, scorer=None, position=0, all_weights=None, term=None, terminfo=None)

由ID列表支持的合成匹配器。

参数
  • ids -- 文档ID列表。

  • weights -- 与ID列表相对应的权重列表。如果未提供此参数,则使用值为1.0的列表。

  • values -- 与标识列表相对应的编码值列表。

  • format -- 一 whoosh.formats.Format 表示字段格式的对象。

  • scorer -- 一 whoosh.scoring.BaseScorer 为过账计分的对象。

  • term -- 一 ("fieldname", "text") tuple,如果这不是术语matcher,则为none。

class whoosh.matching.WrappingMatcher(child, boost=1.0)

包装子匹配器的匹配器的基类。

class whoosh.matching.MultiMatcher(matchers, idoffsets, scorer=None, current=0)

序列化子匹配器列表的结果。

参数
  • matchers -- Matcher对象列表。

  • idoffsets -- 与中的项相对应的偏移列表 matchers 名单。

class whoosh.matching.FilterMatcher(child, ids, exclude=False, boost=1.0)

根据ID是否存在于集合中或不存在于集合中,筛选包装中的过账。

参数
  • child -- 小火柴匠。

  • ids -- 要筛选的一组ID。

  • exclude -- 默认情况下,只有来自包装的匹配器的ID in 使用该集合。如果此参数为真,则只有包装的匹配器的ID not in 使用该集合。

class whoosh.matching.BiMatcher(a, b)

Base class for matchers that combine the results of two sub-matchers in some way.

class whoosh.matching.AdditiveBiMatcher(a, b)

二元匹配器的基类,其中子匹配器的分数相加。

class whoosh.matching.UnionMatcher(a, b)

匹配两个子匹配项中发布的并集(或)。

class whoosh.matching.DisjunctionMaxMatcher(a, b, tiebreak=0.0)

匹配两个子匹配项的联合(或)。Where both sub-matchers match the same posting, returns the weight/score of the higher-scoring posting.

class whoosh.matching.IntersectionMatcher(a, b)

匹配两个子匹配项中过账的交集(和)。

class whoosh.matching.AndNotMatcher(a, b)

匹配第一个子匹配器中第二个子匹配器中不存在的日志。

class whoosh.matching.InverseMatcher(child, limit, missing=None, weight=1.0, id=0)

合成匹配器,生成包装的匹配器中不存在的日志。

class whoosh.matching.RequireMatcher(a, b)

匹配两个子匹配项中的日志,但只使用第一个匹配项的分数。

class whoosh.matching.AndMaybeMatcher(a, b)

匹配第一个子匹配者中的帖子,如果相同的帖子在第二个子匹配者中,则添加他们的分数。

class whoosh.matching.ConstantScoreMatcher(score=1.0)

例外情况

exception whoosh.matching.ReadTooFar

提出时 next()skip_to() 在不活动的匹配器上调用。

exception whoosh.matching.NoQualityAvailable

在不支持块质量优化的Matcher上调用质量方法时引发。