View Single Post
Old 08-31-2022, 03:09 AM   #1
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,614
Karma: 7891011
Join Date: Sep 2020
Device: none
FTS - Exporting the search

As we discussed incidentally in other thread (link to Kovid's reply), I suggested it would be nice to have the ability to export the FTS search. BTW, I don't mean exporting the title results related to some FTS query, but the actual search, including the results snippets.

I had never used Calibre CLI, but the recent addition of FTS to calibredb has been quite useful for that purpose, so I gave it a try.

Using the commands below, I was able to generate the attached files, which contain the results snippets:

Code:
calibredb fts_search --include-snippets --output-format=text NEAR("biphasic" "sleep",30) > fts-export.txt
calibredb fts_search --include-snippets --output-format=json NEAR("biphasic" "sleep",30) > fts-export.json
Files generated contain special characters that I had cleaned up by using Notepad++ and replacing them as following:
  •  for >
  •  for <

Although using the CLI requires some practice for average users, the exported search was useful to me, even having to do that cleaning/beautifying. And the fact that one needs to close any Calibre instance before using calibredb is a little bothersome...

So I present some questions:

- if there's a better way to have the FTS search neatly exported, perhaps through some advanced batch scripting?

- is there some way to call calibredb on a read-only fashion, so that Calibre GUI instance can be kept open?

- would it be possible, in the future, to obtain the exported search in the form of a catalogue, as BR suggested (but including the results snippets)? Or maybe some other form that could generate a file that can be "read like a book"... something like that.
Attached Files
File Type: zip fts-export(CLI).zip (13.0 KB, 324 views)
Comfy.n is offline   Reply With Quote