类:Mongoid::SearchIndexable::Status Private

继承:
对象
  • 对象
显示全部
定义于:
lib/mongoid/search_indexable.rb

Overview

此类是私有 API 的一部分。 应尽可能避免使用此类,因为它将来可能会被删除或更改。

表示 search_indexes 调用返回的索引的状态。

实例属性摘要折叠

实例方法摘要折叠

构造函数详情

#initialize(indexes) ⇒ Status

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

创建一个新的状态对象。

参数:

  • 索引 ( Array<Hash> )

    原始索引文档



20
21
22
# File 'lib/mongoid/search_indexable.rb', line 20

def 初始化(索引)
  @indexes = 索引
end

实例属性详细信息

#个索引Array<Hash> (只读)

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回原始索引文档。

返回:

  • ( Array<Hash> )

    原始索引文档



15
16
17
# File 'lib/mongoid/search_indexable.rb', line 15

def 索引
  @indexes
end

实例方法详细信息

#待处理Array<Hash>

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回状态为 == 'PENDING' 的索引子集

返回:

  • ( Array<Hash> )

    “待处理”索引的索引文档



34
35
36
# File 'lib/mongoid/search_indexable.rb', line 34

def 待处理
  索引.SELECT { |i| i['status'] == ' PENDING ' }
end

# queryableArray<Hash>

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回标记为“可查询”的索引子集

返回:

  • ( Array<Hash> )

    “可查询”索引的索引文档



41
42
43
# File 'lib/mongoid/search_indexable.rb', line 41

def 可查询
  索引.SELECT { |i| i['queryable'] }
end

#准备就绪Array<Hash>

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回 status == 'READY' 的索引子集

返回:

  • ( Array<Hash> )

    “就绪”索引的索引文档



27
28
29
# File 'lib/mongoid/search_indexable.rb', line 27

def 准备就绪
  索引.SELECT { |i| i['status'] == ' READY ' }
end

#准备好了吗?true | false

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

如果所有给定索引均已“就绪”且“可查询”,则返回 true。

返回:

  • ( true | false )

    所有索引的就绪状态



48
49
50
# File 'lib/mongoid/search_indexable.rb', line 48

def 准备好了吗?
  索引.全部? { |i| i['status'] == ' READY ' && i['queryable'] }
end