calibredb.el icon indicating copy to clipboard operation
calibredb.el copied to clipboard

Filtering by tag doesn't work when calibredb-tag-width set to 0

Open sarg opened this issue 4 months ago • 0 comments

Filtering by tag when its column width is set to zero yields:

(sqlite-error ("SQL logic error" "near \"LIMIT\": syntax error" 1 1))
  transient--exit-and-debug(error (sqlite-error ("SQL logic error" "near \"LIMIT\": syntax error" 1 1)))
  calibredb-query("SELECT * .... WHERE  LIMIT 44 ")
  calibredb-candidates(:where " LIMIT 44 " :count nil)
  (let* ((words (split-string filter " ")) (limit (plist-get properties :limit)) (count (plist-get properties :count)) (page (plist-get properties :page))) (calibredb-candidates :where (concat (cond (calibredb-tag-filter-p (mapconcat #'(lambda ... ...) words " AND ")) (calibredb-format-filter-p (mapconcat #'(lambda ... ...) words " AND ")) (calibredb-author-filter-p (mapconcat #'(lambda ... ...) words " AND ")) (calibredb-date-filter-p (mapconcat #'(lambda ... ...) words " AND ")) (t (mapconcat #'(lambda ... ...) words " AND "))) (if limit (progn (format " LIMIT %s " limit))) (if page (progn (format " OFFSET %s " (* (1- page) calibredb-search-page-max-rows))))) :count count))
  calibredb-search-candidates("read" :limit 44 :page nil)

That happens due to this check in calibredb-search-candidates: https://github.com/chenyanming/calibredb.el/blob/master/calibredb-search.el#L893

Also it seems that there is a copy-paste mistake as other cases of cond also check the same condition (equal (calibredb-tag-width) 0)

sarg avatar Oct 14 '24 18:10 sarg