Function: nnir-imap-make-query

nnir-imap-make-query is a byte-compiled function defined in nnir.el.gz.

Signature

(nnir-imap-make-query CRITERIA QSTRING)

Documentation

Make an IMAP search expression from QSTRING and CRITERIA.

This implements a little language designed to return the expected results to an arbitrary query string to the end user.

The search is always case-insensitive, as defined by RFC2060, and supports the following features (inspired by the Google search input language):

Automatic "and" queries
    If you specify multiple words then they will be treated as an
    "and" expression intended to match all components.

Phrase searches
    If you wrap your query in double-quotes then it will be treated
    as a literal string.

Negative terms
    If you precede a term with "-" then it will negate that.

"OR" queries
    If you include an upper-case "OR" in your search it will cause
    the term before it and the term after it to be treated as
    alternatives.

In the future the following will be added to the language:
 * support for date matches
 * support for location of text matching within the query
 * from/to/etc headers
 * additional search terms
 * flag based searching
 * anything else that the RFC supports, basically.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/nnir.el.gz
(defun nnir-imap-make-query (criteria qstring)
  "Make an IMAP search expression from QSTRING and CRITERIA.

This implements a little language designed to return the expected
results to an arbitrary query string to the end user.

The search is always case-insensitive, as defined by RFC2060, and
supports the following features (inspired by the Google search input
language):

Automatic \"and\" queries
    If you specify multiple words then they will be treated as an
    \"and\" expression intended to match all components.

Phrase searches
    If you wrap your query in double-quotes then it will be treated
    as a literal string.

Negative terms
    If you precede a term with \"-\" then it will negate that.

\"OR\" queries
    If you include an upper-case \"OR\" in your search it will cause
    the term before it and the term after it to be treated as
    alternatives.

In the future the following will be added to the language:
 * support for date matches
 * support for location of text matching within the query
 * from/to/etc headers
 * additional search terms
 * flag based searching
 * anything else that the RFC supports, basically."
  ;; Walk through the query and turn it into an IMAP query string.
  (nnir-imap-query-to-imap criteria (nnir-imap-parse-query qstring)))