From e765da76f61b7afe39f74ea4b2da9a489603f6a9 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Tue, 26 Apr 2011 15:06:30 +0100 Subject: [PATCH] Fix 'count-of' searches (e.g., tags:#>3). Add a small blurb to the manual. --- src/calibre/library/caches.py | 4 +--- src/calibre/manual/gui.rst | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index ca256e0350..543c6eab96 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -406,11 +406,9 @@ class ResultCache(SearchQueryParser): # {{{ if val_func is None: loc = self.field_metadata[location]['rec_index'] val_func = lambda item, loc=loc: item[loc] - dt = self.field_metadata[location]['datatype'] - q = '' - val_func = lambda item, loc=loc: item[loc] cast = adjust = lambda x: x + dt = self.field_metadata[location]['datatype'] if query == 'false': if dt == 'rating' or location == 'cover': diff --git a/src/calibre/manual/gui.rst b/src/calibre/manual/gui.rst index 7b6e60c93a..a4e18c2e07 100644 --- a/src/calibre/manual/gui.rst +++ b/src/calibre/manual/gui.rst @@ -365,6 +365,8 @@ Dates and numeric fields support the relational operators ``=`` (equals), ``>`` Rating fields are considered to be numeric. For example, the search ``rating:>=3`` will find all books rated 3 or higher. +You can search for the number of items in multiple-valued fields such as tags). These searches begin with the character ``#``, then use the same syntax as numeric fields. For example, to find all books with more than 4 tags, use ``tags:#>4``. To find all books with exactly 10 tags, use ``tags:#=10``. + Series indices are searchable. For the standard series, the search name is 'series_index'. For custom series columns, use the column search name followed by _index. For example, to search the indices for a custom series column named ``#my_series``, you would use the search name ``#my_series_index``.