diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 3d24499e94..0ca3b5a2de 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -151,7 +151,7 @@ class Matches(QAbstractItemModel):
mod_query = query
# Remove filter identifiers
# Remove the prefix.
- for loc in ('all', 'author', 'author2', 'authors', 'title'):
+ for loc in ('all', 'author', 'author2', 'authors', 'title', 'title2'):
query = re.sub(r'%s:"(?P[^\s"]+)"' % loc, '\g', query)
query = query.replace('%s:' % loc, '')
# Remove the prefix and search text.
@@ -318,6 +318,7 @@ class SearchFilter(SearchQueryParser):
'formats',
'price',
'title',
+ 'title2',
'store',
]
@@ -396,6 +397,7 @@ class SearchFilter(SearchQueryParser):
for x in ('author', 'download', 'format'):
q[x+'s'] = q[x]
q['author2'] = q['author']
+ q['title2'] = q['title']
# make the price in query the same format as result
if location == 'price':
@@ -446,9 +448,9 @@ class SearchFilter(SearchQueryParser):
if locvalue == 'format':
vals = accessor(sr).split(',')
- elif locvalue == 'author2':
+ elif locvalue in ('author2', 'title2'):
m = self.IN_MATCH
- vals = re.sub(r'(^|\s)(and|not|or|a|the|is|of|,)(\s|$)', ' ', query).split(' ')
+ vals = re.sub(r'(^|\s)(and|not|or|a|the|is|of|,)(\s|$)', ' ', accessor(sr)).split(' ')
else:
vals = [accessor(sr)]
if self._match(query, vals, m):
diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py
index 9f401d436c..b4ae0bc943 100644
--- a/src/calibre/gui2/store/search/search.py
+++ b/src/calibre/gui2/store/search/search.py
@@ -167,10 +167,9 @@ class SearchDialog(QDialog, Ui_Dialog):
# Don't start a search if there is nothing to search for.
query = []
if self.search_title.text():
- query.append(u'title:"~%s"' % unicode(self.search_title.text()).replace(" ", ".*"))
+ query.append(u'title2:"~%s"' % unicode(self.search_title.text()).replace('"', ' '))
if self.search_author.text():
- query.append(u'author2:"%s"' % unicode(self.search_author.text()))
- #query.append(u'author:"~%s"' % unicode(self.search_author.text()).replace(" ", ".*"))
+ query.append(u'author2:"%s"' % unicode(self.search_author.text()).replace('"', ' '))
if self.search_edit.text():
query.append(unicode(self.search_edit.text()))
query = " ".join(query)
@@ -212,7 +211,7 @@ class SearchDialog(QDialog, Ui_Dialog):
query = query.replace('>', '')
query = query.replace('<', '')
# Remove the prefix.
- for loc in ('all', 'author', 'author2', 'authors', 'title'):
+ for loc in ('all', 'author', 'author2', 'authors', 'title', 'title2'):
query = re.sub(r'%s:"(?P[^\s"]+)"' % loc, '\g', query)
query = query.replace('%s:' % loc, '')
# Remove the prefix and search text.