Search a mailbox.
public search ( mixed $mailbox, Horde_Imap_Client_Search_Query $query = null, array $options = [] ) : array | ||
$mailbox | mixed | The mailbox to search. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8). |
$query | Horde_Imap_Client_Search_Query | The search query. Defaults to an ALL search. |
$options | array | Additional options:
- nocache: (boolean) Don't cache the results. DEFAULT: false (results cached, if possible) - partial: (mixed) The range of results to return (message sequence numbers) Only a single range is supported (represented by the minimum and maximum values contained in the range given). DEFAULT: All messages are returned. - results: (array) The data to return. Consists of zero or more of the following flags: - Horde_Imap_Client::SEARCH_RESULTS_COUNT - Horde_Imap_Client::SEARCH_RESULTS_MATCH (DEFAULT) - Horde_Imap_Client::SEARCH_RESULTS_MAX - Horde_Imap_Client::SEARCH_RESULTS_MIN - Horde_Imap_Client::SEARCH_RESULTS_SAVE - Horde_Imap_Client::SEARCH_RESULTS_RELEVANCY - sequence: (boolean) If true, returns an array of sequence numbers. DEFAULT: Returns an array of UIDs - sort: (array) Sort the returned list of messages. Multiple sort criteria can be specified. Any sort criteria can be sorted in reverse order (instead of the default ascending order) by adding a Horde_Imap_Client::SORT_REVERSE element to the array directly before adding the sort element. The following sort criteria are available: - Horde_Imap_Client::SORT_ARRIVAL - Horde_Imap_Client::SORT_CC - Horde_Imap_Client::SORT_DATE - Horde_Imap_Client::SORT_DISPLAYFROM On servers that don't support SORT=DISPLAY, this criteria will fallback to doing client-side sorting. - Horde_Imap_Client::SORT_DISPLAYFROM_FALLBACK On servers that don't support SORT=DISPLAY, this criteria will fallback to Horde_Imap_Client::SORT_FROM [since 2.4.0]. - Horde_Imap_Client::SORT_DISPLAYTO On servers that don't support SORT=DISPLAY, this criteria will fallback to doing client-side sorting. - Horde_Imap_Client::SORT_DISPLAYTO_FALLBACK On servers that don't support SORT=DISPLAY, this criteria will fallback to Horde_Imap_Client::SORT_TO [since 2.4.0]. - Horde_Imap_Client::SORT_FROM - Horde_Imap_Client::SORT_SEQUENCE - Horde_Imap_Client::SORT_SIZE - Horde_Imap_Client::SORT_SUBJECT - Horde_Imap_Client::SORT_TO [On servers that support SEARCH=FUZZY, this criteria is also available:] - Horde_Imap_Client::SORT_RELEVANCY |
Résultat | array | An array with the following keys:
- count: (integer) The number of messages that match the search criteria. Always returned. - match: (Horde_Imap_Client_Ids) The IDs that match $criteria, sorted if the 'sort' modifier was set. Returned if Horde_Imap_Client::SEARCH_RESULTS_MATCH is set. - max: (integer) The UID (default) or message sequence number (if 'sequence' is true) of the highest message that satisifies $criteria. Returns null if no matches found. Returned if Horde_Imap_Client::SEARCH_RESULTS_MAX is set. - min: (integer) The UID (default) or message sequence number (if 'sequence' is true) of the lowest message that satisifies $criteria. Returns null if no matches found. Returned if Horde_Imap_Client::SEARCH_RESULTS_MIN is set. - modseq: (integer) The highest mod-sequence for all messages being returned. Returned if 'sort' is false, the search query includes a MODSEQ command, and the server supports the CONDSTORE IMAP extension. - relevancy: (array) The list of relevancy scores. Returned if Horde_Imap_Client::SEARCH_RESULTS_RELEVANCY is set and the server supports FUZZY search matching. - save: (boolean) Whether the search results were saved. Returned if Horde_Imap_Client::SEARCH_RESULTS_SAVE is set. |