Cleanup search template documentation

This commit is contained in:
Kovid Goyal 2020-09-27 10:15:58 +05:30
parent dac576f52b
commit 0699bbfee6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -441,19 +441,29 @@ Identifiers (e.g., ISBN, doi, lccn etc) also use an extended syntax. First, note
:guilabel:`Advanced search dialog` :guilabel:`Advanced search dialog`
You can search using a template in the :ref:`templatelangcalibre` instead of a metadata field. To do so you enter a template, a search type, and the value to search for. The syntax is:: You can search using a template in the :ref:`templatelangcalibre` instead of a
metadata field. To do so you enter a template, a search type, and the value to
search for. The syntax is::
``template:``(the template)``#@#:``(search type)``:``(the value) template: (the template) #@#: (search type) : (the value)
The ``template`` is any valid calibre template language template. The ``search type`` must be one of ``t`` (text search), ``d`` (date search), ``n`` (numeric search), or ``b`` (set/not set (boolean)). The ``value`` is whatever you want. It can use the special operators described above for the various search types. You must quote the entire search string if there are spaces anywhere in it. The ``template`` is any valid calibre template language template. The ``search
type`` must be one of ``t`` (text search), ``d`` (date search), ``n`` (numeric
search), or ``b`` (set/not set (boolean)). The ``value`` is whatever you want.
It can use the special operators described above for the various search types.
You must quote the entire search string if there are spaces anywhere in it.
Examples: Examples:
* ``template:"program: connected_device_name('main')#@#:t:kindle"`` -- is true of the ``kindle`` device is connected * ``template:"program: connected_device_name('main')#@#:t:kindle"`` -- is true when the ``kindle`` device is connected
* ``template:"program: select(formats_sizes(), 'EPUB')#@#:n:>1000000"`` -- finds epubs larger than 1 MB * ``template:"program: select(formats_sizes(), 'EPUB')#@#:n:>1000000"`` -- finds books with EPUB files larger than 1 MB
* ``template:"program: select(formats_modtimes('iso'), 'EPUB')#@#:d:>10daysago"`` -- finds epubs newer than 10 days ago. * ``template:"program: select(formats_modtimes('iso'), 'EPUB')#@#:d:>10daysago"`` -- finds books with EPUB files newer than 10 days ago
You can build template search queries easily using the :guilabel:`Advanced search dialog` accessed by clicking the button |sbi|. You can test templates on specific books using the calibre ``template tester``. Easiest is to add the tester to the book list context menu or to assign the tester a keyboard shortcut. You can build template search queries easily using the :guilabel:`Advanced
search dialog` accessed by clicking the button |sbi|. You can test templates on
specific books using the calibre :guilabel:`Template tester`. This can be added
to the toolbars or menus via :guilabel:`Preferences->Toolbars & menus`. It can
also be assigned a keyboard shortcut via :guilabel:`Preferences->Shortcuts`.
.. _saved_searches: .. _saved_searches: