class Net::IMAP::ESearchResult
IMAP#add_response_handler to handle these responses.
responses after the initiating command has completed. Use
Some search extensions may result in the server sending ESearchResultSEARCH
result when return
options are specified.
requires an ESEARCH
result, such as PARTIAL
, but still only return a
Note that some servers may claim to support a search extension which
has been enabled. IMAP4rev2
requires ESEARCH
results.
* The server supports IMAP4rev2
but not IMAP4rev1
, or IMAP4rev2
NOTE: IMAP#search and IMAP#uid_search do not support ESORT
yet.
.
The server must support the ESORT
extension
* Return options were specified for IMAP#sort or IMAP#uid_sort.
such as ESEARCH
, PARTIAL
, or IMAP4rev2
.<br>RFC4466 return
options,
The server must support a search extension which allows
* Return options were specified for IMAP#search or IMAP#uid_search.
IMAP#sort, and IMAP#uid_sort under any of the following conditions:
returned (instead of SearchResult) by IMAP#search, IMAP#uid_search,
An “extended search” response (ESEARCH
). ESearchResult should be
def all; data.assoc("ALL")&.last end
+IMAP4rev2+ {[RFC9051]}[https://www.rfc-editor.org/rfc/rfc9051.html#section-7.3.4].
Requires +ESEARCH+ {[RFC4731]}[https://www.rfc-editor.org/rfc/rfc4731.html#section-3.1] or
the +ALL+ return option was not specified but other return options were.
Returns +nil+ when the associated search command has no results, or when
satisfy the SEARCH criteria.
A SequenceSet containing all message sequence numbers or UIDs that
:call-seq: all -> sequence set or nil
def all; data.assoc("ALL")&.last end
def count; data.assoc("COUNT")&.last end
Requires +ESEARCH+ {[RFC4731]}[https://www.rfc-editor.org/rfc/rfc4731.html#section-3.1] or
the +COUNT+ return option wasn't specified.
Returns +nil+ when the associated search command has no results, or when
Returns the number of messages that satisfy the SEARCH criteria.
:call-seq: count -> integer or nil
def count; data.assoc("COUNT")&.last end
def initialize(tag: nil, uid: nil, data: nil)
def initialize(tag: nil, uid: nil, data: nil) tag => String | nil; tag = -tag if tag uid => true | false | nil; uid = !!uid data => Array | nil; data ||= []; data.freeze super end
def max; data.assoc("MAX")&.last end
Requires +ESEARCH+ {[RFC4731]}[https://www.rfc-editor.org/rfc/rfc4731.html#section-3.1] or
the +MAX+ return option wasn't specified.
Returns +nil+ when the associated search command has no results, or when
The highest message number/UID that satisfies the SEARCH criteria.
:call-seq: max -> integer or nil
def max; data.assoc("MAX")&.last end
def min; data.assoc("MIN")&.last end
Requires +ESEARCH+ {[RFC4731]}[https://www.rfc-editor.org/rfc/rfc4731.html#section-3.1] or
the +MIN+ return option wasn't specified.
Returns +nil+ when the associated search command has no results, or when
The lowest message number/UID that satisfies the SEARCH criteria.
:call-seq: min -> integer or nil
def min; data.assoc("MIN")&.last end
def modseq; data.assoc("MODSEQ")&.last end
Requires +CONDSTORE+ {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html]
+MODSEQ+ search criteria will implicitly enable +CONDSTORE+.
returned whenever the +CONDSTORE+ extension has been enabled. Using the
Note that there is no search +return+ option for +MODSEQ+. It will be
the +MODSEQ+ search criterion wasn't specified.
Returns +nil+ when the associated search command has no results, or when
The highest +mod-sequence+ of all messages being returned.
:call-seq: modseq -> integer or nil
def modseq; data.assoc("MODSEQ")&.last end
def partial; data.assoc("PARTIAL")&.last end
{[RFC5267]}[https://www.rfc-editor.org/rfc/rfc5267.html]
or CONTEXT=SEARCH/CONTEXT=SORT
Requires +PARTIAL+ {[RFC9394]}[https://www.rfc-editor.org/rfc/rfc9394.html]
UIDs that satisfy the SEARCH criteria.
A PartialResult containing a subset of the message sequence numbers or
:call-seq: partial -> PartialResult or nil
def partial; data.assoc("PARTIAL")&.last end
def to_a; all&.numbers || partial&.to_a || [] end
Note that SearchResult also implements +to_a+, so it can be used without
the IMAP#search +RETURN+ options, #to_a returns an empty array.
returned no results or because +ALL+ and +PARTIAL+ were not included in
When both #all and #partial are +nil+, either because the server
numbers or UIDs, +to_a+ returns that set as an array of integers.
When either #all or #partial contains a SequenceSet of message sequence
:call-seq: to_a -> Array of integers
def to_a; all&.numbers || partial&.to_a || [] end