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-tables | A list of completion tables used to search for messages from contacts. |
gnus-search-date-keys | A list of keywords whose value should be parsed as a date. |
gnus-search-default-engines | Alist of default search engines keyed by server method. |
gnus-search-engine-instance-alist | Mapping between servers and instantiated search engines. |
gnus-search-expandable-keys | A list of strings representing expandable search keys. |
gnus-search-history | Internal history of Gnus searches. |
gnus-search-ignored-newsgroups | A regexp to match newsgroups in the active file that should |
gnus-search-imap-raw-queries-p | If t, all IMAP engines will only accept raw search query strings. |
gnus-search-imap-search-keys | Known IMAP search keys. |
gnus-search-mairix-config-file | Configuration file for mairix. |
gnus-search-mairix-program | Name of mairix search executable. |
gnus-search-mairix-raw-queries-p | If t, all Mairix engines will only accept raw search query strings. |
gnus-search-mairix-remove-prefix | The prefix to remove from each file name returned by mairix |
gnus-search-mairix-switches | A list of strings, to be given as additional arguments to mairix. |
gnus-search-mu-config-directory | Configuration directory for mu. |
gnus-search-mu-program | Name of the mu search executable. |
gnus-search-mu-raw-queries-p | If t, all mu engines will only accept raw search query strings. |
gnus-search-mu-remove-prefix | A prefix to remove from the mu results to get a group name. |
gnus-search-mu-switches | A list of strings, to be given as additional arguments to mu. |
gnus-search-namazu-index-directory | Index directory for Namazu. |
gnus-search-namazu-program | Name of Namazu search executable. |
gnus-search-namazu-raw-queries-p | If t, all Namazu engines will only accept raw search query strings. |
gnus-search-namazu-remove-prefix | The prefix to remove from each file name returned by Namazu |
gnus-search-namazu-switches | A list of strings, to be given as additional arguments to namazu. |
gnus-search-notmuch-config-file | Configuration file for notmuch. |
gnus-search-notmuch-program | Name of notmuch search executable. |
gnus-search-notmuch-raw-queries-p | If t, all Notmuch engines will only accept raw search query strings. |
gnus-search-notmuch-remove-prefix | The prefix to remove from each file name returned by notmuch |
gnus-search-notmuch-switches | A list of strings, to be given as additional arguments to notmuch. |
gnus-search-swish++-config-file | Location of Swish++ configuration file. |
gnus-search-swish++-program | Name of swish++ search executable. |
gnus-search-swish++-raw-queries-p | If t, all Swish++ engines will only accept raw search query strings. |
gnus-search-swish++-remove-prefix | The prefix to remove from each file name returned by swish++ |
gnus-search-swish++-switches | A list of strings, to be given as additional arguments to swish++. |
gnus-search-swish-e-config-file | Configuration file for swish-e. |
gnus-search-swish-e-index-files | A list of index files to use with this Swish-e instance. |
gnus-search-swish-e-program | Name of swish-e search executable. |
gnus-search-swish-e-raw-queries-p | If t, all Swish-e engines will only accept raw search query strings. |
gnus-search-swish-e-remove-prefix | The prefix to remove from each file name returned by swish-e |
gnus-search-swish-e-switches | A list of strings, to be given as additional arguments to swish-e. |
gnus-search-use-parsed-queries | When t, use Gnus’ generalized search language. |