File: gnus-search.el.html

This file defines a generalized search language, and search engines that interface with various search programs. It is responsible for parsing the user's search input, sending that query to the search engines, and collecting results. Results are in the form of a vector of vectors, each vector representing a found article. The nnselect backend interprets that value to create a group containing the search results.

This file was formerly known as nnir. Later, the backend parts of nnir became nnselect, and only the search functionality was left here.

See the Gnus manual for details of the search language. Tests are in tests/gnus-search-test.el.

The search parsing routines are responsible for accepting the user's search query as a string and parsing it into a sexp structure. The function gnus-search-parse-query is the entry point for that. Once the query is in sexp form, it is passed to the search engines themselves, which are responsible for transforming the query into a form that the external program can understand, and then filtering the search results into a format that nnselect can understand.

The general flow is:

1. The user calls one of gnus-group-make-search-group or
gnus-group-read-ephemeral-search-group (or a few other entry points). These functions prompt for a search query, and collect the groups to search, then create an nnselect group, setting an
'nnselect-specs group parameter where 'nnselect-function is
gnus-search-run-query, and 'nnselect-args is the search query and groups to search.

2. gnus-search-run-query is called with 'nnselect-args. It looks
at the groups to search, categorizes them by server, and for each server finds the search engine to use. It calls each engine's gnus-search-run-search method with the query and groups passed as arguments, and the results are collected and handed off to the nnselect group.

For information on writing new search engines, see the Gnus manual.

TODO: Rewrite the query parser using syntax tables and parse-partial-sexp.

TODO: Refactor IMAP search so we can move code that uses nnimap-* functions out into nnimap.el.

TODO: Is there anything we can do about sorting results?

TODO: Provide for returning a result count. This would probably need a completely separate top-level command, since we wouldn't be creating a group at all.

Defined variables (41)

gnus-search-contact-tablesA list of completion tables used to search for messages from contacts.
gnus-search-date-keysA list of keywords whose value should be parsed as a date.
gnus-search-default-enginesAlist of default search engines keyed by server method.
gnus-search-engine-instance-alistMapping between servers and instantiated search engines.
gnus-search-expandable-keysA list of strings representing expandable search keys.
gnus-search-historyInternal history of Gnus searches.
gnus-search-ignored-newsgroupsRegexp matching newsgroups in the active file to skip when searching.
gnus-search-imap-raw-queries-pIf t, all IMAP engines will only accept raw search query strings.
gnus-search-imap-search-keysKnown IMAP search keys.
gnus-search-mairix-config-fileConfiguration file for mairix.
gnus-search-mairix-programName of mairix search executable.
gnus-search-mairix-raw-queries-pIf t, all Mairix engines will only accept raw search query strings.
gnus-search-mairix-remove-prefixThe prefix to remove from each file name returned by mairix
gnus-search-mairix-switchesA list of strings, to be given as additional arguments to mairix.
gnus-search-mu-config-directoryConfiguration directory for mu.
gnus-search-mu-programName of the mu search executable.
gnus-search-mu-raw-queries-pIf t, all mu engines will only accept raw search query strings.
gnus-search-mu-remove-prefixA prefix to remove from the mu results to get a group name.
gnus-search-mu-switchesA list of strings, to be given as additional arguments to mu.
gnus-search-namazu-index-directoryIndex directory for Namazu.
gnus-search-namazu-programName of Namazu search executable.
gnus-search-namazu-raw-queries-pIf t, all Namazu engines will only accept raw search query strings.
gnus-search-namazu-remove-prefixThe prefix to remove from each file name returned by Namazu
gnus-search-namazu-switchesA list of strings, to be given as additional arguments to namazu.
gnus-search-notmuch-config-fileConfiguration file for notmuch.
gnus-search-notmuch-programName of notmuch search executable.
gnus-search-notmuch-raw-queries-pIf t, all Notmuch engines will only accept raw search query strings.
gnus-search-notmuch-remove-prefixThe prefix to remove from each file name returned by notmuch
gnus-search-notmuch-switchesA list of strings, to be given as additional arguments to notmuch.
gnus-search-swish++-config-fileLocation of Swish++ configuration file.
gnus-search-swish++-programName of swish++ search executable.
gnus-search-swish++-raw-queries-pIf t, all Swish++ engines will only accept raw search query strings.
gnus-search-swish++-remove-prefixThe prefix to remove from each file name returned by swish++
gnus-search-swish++-switchesA list of strings, to be given as additional arguments to swish++.
gnus-search-swish-e-config-fileConfiguration file for swish-e.
gnus-search-swish-e-index-filesA list of index files to use with this Swish-e instance.
gnus-search-swish-e-programName of swish-e search executable.
gnus-search-swish-e-raw-queries-pIf t, all Swish-e engines will only accept raw search query strings.
gnus-search-swish-e-remove-prefixThe prefix to remove from each file name returned by swish-e
gnus-search-swish-e-switchesA list of strings, to be given as additional arguments to swish-e.
gnus-search-use-parsed-queriesWhen t, use Gnus’ generalized search language.

Defined functions (111)

gnus-search--complete-key-data()
gnus-search-engine(&rest _)
gnus-search-engine--eieio-childp(OBJ)
gnus-search-engine-child-p(OBJ)
gnus-search-engine-list-p(ARG1)
gnus-search-engine-p(OBJ)
gnus-search-find-grep(&rest SLOTS)
gnus-search-find-grep--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-find-grep--eieio-childp(OBJ)
gnus-search-find-grep-child-p(OBJ)
gnus-search-find-grep-list-p(ARG1)
gnus-search-find-grep-p(OBJ)
gnus-search-get-active(SRV)
gnus-search-grep(&rest _)
gnus-search-grep--eieio-childp(OBJ)
gnus-search-grep-child-p(OBJ)
gnus-search-grep-list-p(ARG1)
gnus-search-grep-p(OBJ)
gnus-search-grep-search(ENGINE ARTLIST CRITERIA)
gnus-search-imap(&rest SLOTS)
gnus-search-imap--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-imap--eieio-childp(OBJ)
gnus-search-imap-child-p(OBJ)
gnus-search-imap-handle-date(ARG0 ARG &rest ARGS)
gnus-search-imap-handle-flag(FLAG)
gnus-search-imap-handle-string(ARG0 ARG &rest ARGS)
gnus-search-imap-list-p(ARG1)
gnus-search-imap-p(OBJ)
gnus-search-imap-search-command(ARG0 ARG &rest ARGS)
gnus-search-indexed(&rest _)
gnus-search-indexed--eieio-childp(OBJ)
gnus-search-indexed-child-p(OBJ)
gnus-search-indexed-extract(ENGINE)
gnus-search-indexed-list-p(ARG1)
gnus-search-indexed-p(OBJ)
gnus-search-indexed-parse-output(ENGINE SERVER QUERY &optional GROUPS)
gnus-search-indexed-search-command(ARG0 ARG &rest ARGS)
gnus-search-mairix(&rest SLOTS)
gnus-search-mairix--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-mairix--eieio-childp(OBJ)
gnus-search-mairix-child-p(OBJ)
gnus-search-mairix-handle-date(EXPR)
gnus-search-mairix-handle-mark(EXPR)
gnus-search-mairix-handle-size(EXPR)
gnus-search-mairix-list-p(ARG1)
gnus-search-mairix-p(OBJ)
gnus-search-mairix-treat-string(STR)
gnus-search-make-query-string(ENGINE QUERY-SPEC)
gnus-search-make-spec(ARG)
gnus-search-mu(&rest SLOTS)
gnus-search-mu--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-mu--eieio-childp(OBJ)
gnus-search-mu-child-p(OBJ)
gnus-search-mu-handle-date(DATE)
gnus-search-mu-handle-flag(FLAG)
gnus-search-mu-list-p(ARG1)
gnus-search-mu-p(OBJ)
gnus-search-namazu(&rest SLOTS)
gnus-search-namazu--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-namazu--eieio-childp(OBJ)
gnus-search-namazu-child-p(OBJ)
gnus-search-namazu-list-p(ARG1)
gnus-search-namazu-p(OBJ)
gnus-search-nnselect(&rest SLOTS)
gnus-search-nnselect--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-nnselect--eieio-childp(OBJ)
gnus-search-nnselect-child-p(OBJ)
gnus-search-nnselect-list-p(ARG1)
gnus-search-nnselect-p(OBJ)
gnus-search-notmuch(&rest SLOTS)
gnus-search-notmuch--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-notmuch--eieio-childp(OBJ)
gnus-search-notmuch-child-p(OBJ)
gnus-search-notmuch-list-p(ARG1)
gnus-search-notmuch-p(OBJ)
gnus-search-parse-query(STRING)
gnus-search-prepare-query(QUERY-SPEC)
gnus-search-process(&rest _)
gnus-search-process--eieio-childp(OBJ)
gnus-search-process-child-p(OBJ)
gnus-search-process-list-p(ARG1)
gnus-search-process-p(OBJ)
gnus-search-query-end-of-input()
gnus-search-query-expand-key(KEY)
gnus-search-query-next-expr(&optional COUNT HALT)
gnus-search-query-next-symbol(&optional COUNT)
gnus-search-query-next-term(&optional COUNT)
gnus-search-query-parse-date(VALUE &optional REL-DATE)
gnus-search-query-parse-kv(KEY VALUE)
gnus-search-query-parse-mark(MARK)
gnus-search-query-peek-symbol()
gnus-search-query-return-string(&optional DELIMITED TRIM)
gnus-search-run-query(SPECS)
gnus-search-run-search(ENGINE SERVER QUERY GROUPS)
gnus-search-server-to-engine(SRV)
gnus-search-single-p(QUERY)
gnus-search-swish++(&rest SLOTS)
gnus-search-swish++--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-swish++--eieio-childp(OBJ)
gnus-search-swish++-child-p(OBJ)
gnus-search-swish++-list-p(ARG1)
gnus-search-swish++-p(OBJ)
gnus-search-swish-e(&rest SLOTS)
gnus-search-swish-e--anon-cmacro(WHOLE &rest SLOTS)
gnus-search-swish-e--eieio-childp(OBJ)
gnus-search-swish-e-child-p(OBJ)
gnus-search-swish-e-list-p(ARG1)
gnus-search-swish-e-p(OBJ)
gnus-search-thread(HEADER &optional GROUP SERVER)
gnus-search-transform(ENGINE EXPRESSION)
gnus-search-transform-expression(ENGINE EXPRESSION)

Defined faces (0)