From 91b9bc6f0d9030d8e62b3a471dae6fa81c10d981 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 Jun 2013 09:05:57 +0530 Subject: [PATCH] When searching allow use of uppercase locations When searching allow use of uppercase location names, such as AUTHOR instead of author, automatically lowercasing them. Fixes #1192785 [search errors are replicated automatically](https://bugs.launchpad.net/calibre/+bug/1192785) --- src/calibre/utils/search_query_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py index a4e88d021f..745e01670f 100644 --- a/src/calibre/utils/search_query_parser.py +++ b/src/calibre/utils/search_query_parser.py @@ -240,8 +240,8 @@ class Parser(object): # the search string is something like 'author: "foo"' because it # will be interpreted as 'author:"foo"'. I am choosing to accept the # possible error. The expression should be written '"author:" foo' - if len(words) > 1 and words[0] in self.locations: - loc = words[0] + if len(words) > 1 and words[0].lower() in self.locations: + loc = words[0].lower() words = words[1:] if len(words) == 1 and self.token_type() == self.QUOTED_WORD: return ['token', loc, self.token(advance=True)]