janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.86k stars 1.37k forks source link

[Enhancement] Implement calibre's native search query language #369

Closed ghost closed 6 years ago

ghost commented 7 years ago

allow search syntax, like the following:

title:"harry potter" #customfield1:favorite

OzzieIsaacs commented 6 years ago

There is already a similar feature included, hidden behind the button advanced serach. Does this fullfill your needs. Implementing the search as you suggested is not very user friendly (you have to know the right syntax) and generates much programming effort (you have to parse the search string and combine the results to a huge database query.

ghost commented 6 years ago

May be misunderstanding you, but I don't see Custom Columns in the Advanced Search page. I do see the standard column options.

OzzieIsaacs commented 6 years ago

yes that true, therefor its only similar. so what you are after is searching in custom columns. that could be easier to implement

ghost commented 6 years ago

I guess those are 2 separate requests. One is advanced search string parsing (allowing field specifiers, logic, and/or regex). The other is custom columns support. I personally am more interested in the parsing.

Here are some off the shelf libraries for parsing: Seems more geared toward field specifiers: https://pypi.python.org/pypi/parse More geared toward logic: https://github.com/hgomersall/python-boolean

ghost commented 6 years ago

I changed the title of this after realizing Calibre has this built-in using their search query language, so no external implementation needed - just need to use their API

https://open-books.calibre-ebook.com/search

OzzieIsaacs commented 6 years ago

I don't see an external API for searching in the ebooks, its just describing how to use the commands for searching in the UI. Currently I'm not willing to reimplement the calibre searching commands, as it's too complicated, sorry. I've implemented the search for custom columns.