Commit Graph

132 Commits

Author SHA1 Message Date
Albert S. 496aefaa09 shared: sqlitesearch: Remove unused var 2022-10-26 13:10:00 +02:00
Albert S. c155d25a37 shared: sqlitesearch: Search trigram index too
Search the trigram index too, combining the results
with the results of the "normal" fts index.

Prioritize the latter since it makes more sense to
rank whole words higher.
2022-10-18 16:06:10 +02:00
Albert S. 583d5babf3 shared: sqlitedbservice: Insert to trigram index too 2022-10-18 16:05:19 +02:00
Albert S. 45659cdc59 shared: migrations: Add 4.sql: Begin trigram index 2022-10-18 16:04:00 +02:00
Albert S. 3022bbdfb5 sqlitesearch: escapeftsArgument: Fix wrong escaping of phrase queries 2022-10-02 19:55:10 +02:00
Albert S. b6ac652ade shared: indexer: Report progress more often
Processing dirs with large docs takes time and waiting till the threshold
is reached can be a bit annoying in those cases, so report if last report
was 10+ seconds ago.
2022-09-23 20:08:00 +02:00
Albert S. 31f0568a87 shared: LimitQueue: Change limit type to int
More consistent with "QQueue::size()" and silences warning
2022-08-28 13:10:39 +02:00
Albert S. 10d61acbd0 shared,gui: SearchResult: remove page vector
Since the previous commit we don't group the results
anymore, making the vector redundant
2022-08-24 00:00:11 +02:00
Albert S. eef0fae137 shared,gui,cli: Fix intra-file ordering for content search results
group_concat() does not preserve order of the ORDRE BY rank,
making the ordering quite meaningless for pages inside a file.

The recently introduced combobox to filter on a per file basis
should anyway be prefered than any kind of grouping in queries.

So we just remove the groupings here.

"All files" in the previews tab thus should show the best results
first now, from any files part of the result set.

A GUI option to sort by page instead of rank can be considered.
2022-08-23 23:44:47 +02:00
Albert S. 14730ed208 gui: mainwindow: Add vertical scroll option, default to it
Seems horizontal mode is too unusual according to multiple
feedback.

Allow choosing this the mode in the settings
2022-08-21 22:57:48 +02:00
Albert S. 0c1b57d911 mainwindow: Save/Restore history 2022-08-21 17:48:43 +02:00
Albert S. c0f4087937 sqlitesearch: escapeFtsArgument: Fix handling of '*' prefix search
The * must not be in quotes
2022-08-21 07:55:49 +02:00
Albert S. d900d58f26 shared: migrations: Add 3.sql: Drop potentailly harmful trigger
In [1] it's stated that "If the values "inserted" into the text
columns as part of a 'delete' command are not the same as those
currently stored within the table, the results may be unpredictable."

It's to be assumed only inserting ftsid is unpredictable. We
have no way for a proper delete because files are not immutable
or may have been deleted.

For now the index will contain entries for files that don't exist.
They won't appear in search results as they won't be joined
in the query.

[1] https://www.sqlite.org/fts5.html#the_delete_command
2022-08-14 20:24:21 +02:00
Albert S. ad06497b4b shared: Add LimitQueue which discards oldest entry once limit hit 2022-08-06 09:06:00 +02:00
Albert S. 00abc6bc1b gui, shared: Fix and simplify word extraction regexes
They did not work for chars like '-', causing errors.

We can actually just extract non-space chars for these cases.
2022-08-06 08:57:39 +02:00
Albert S. 076c3c4c7f shared: LooqsQuery: Add implicit AND also for lone words 2022-07-29 10:17:04 +02:00
Albert S. c11fd1a9ff shared: LooqsQuery: Allow constructing from tokens and sort conditions 2022-07-29 10:17:04 +02:00
Albert S. 1849eba190 shared: sqlitesearch: Escape FTS arguments
Most users are not to be expected to be familiar with
sqlite's FTS syntax. It also leads to unnnecessary
arrows in some instances.

So wrap every space separated word in quotes, unless
it's already in quotes. Then we just escape those with
double-quotes.
2022-07-28 17:49:40 +02:00
Albert S. 1da8344295 shared: Adjust queries to db revision 2 2022-07-28 14:00:46 +02:00
Albert S. 78f38fa418 shared: migrations: Add 2.sql: Change to contentless FTS
We never used the content copy we stored. It only wasted space.

Update scheme so we do not store the content anymore. Switch
to contentless FTS approach
2022-07-28 14:00:46 +02:00
Albert S. c03d7da821 shared: common: Remove migration logic from ensureConfigured()
Running migrations is okay for initialization. However, doing
it here might take ages, so the GUI simply would not show up.

Therefore, migration must be done by the CLI or GUI and they
should show that migrations are running
2022-07-28 13:31:13 +02:00
Albert S. 49b57e1740 shared: DBMigrator: Take DatabaseFactory, run vacuum, add error() sig, start() slot 2022-07-28 13:27:37 +02:00
Albert S. 5996971195 shared: common: setPdfViewer(): Fix misplaced QSettings 2022-07-24 23:57:38 +02:00
Albert S. bf1265fe3a shared: Retire Common::findInPath() for builtin Qt function 2022-07-24 18:19:38 +02:00
Albert S. ab064c3e3b gui: mainwindow: Add menu action to open web user manual 2022-07-23 20:16:19 +02:00
Albert S. cc9dae37e5 shared: Indexer: Use isErrorSaveFileResult() to check for non-successful results 2022-07-11 17:14:45 +02:00
Albert S. 64a9638d1e shared: SaveFileResult: Introduce isErrorSaveFileResult() 2022-07-11 17:13:58 +02:00
Albert S. 5ffd7ae97e shared: common: setPdfViewer(): Fix missing spaces between viewer and args 2022-06-29 19:31:40 +02:00
Albert S. 990888efc1 shared: Include license texts as resource 2022-06-29 18:00:05 +02:00
Albert S. 1636e39c5b shared: ParallelDirScanner: Fix missing progress report from top-level scan 2022-06-27 23:11:26 +02:00
Albert S. bda23670e3 shared: ParallelDirScanner: Correct filter to 'NoDotAndDotDot' from 'NoDotDot' 2022-06-27 23:10:53 +02:00
Albert S. a561032668 shared: Indexer: Adjust for OK_WASEMPTY 2022-06-24 19:17:50 +02:00
Albert S. b8006bde7b shared: FileSaver: Don't launch SandboxedProcessor for empty files 2022-06-24 19:17:50 +02:00
Albert S. 614238edda shared: FileSaver: Print message for OK_WASEMPTY 2022-06-24 19:17:50 +02:00
Albert S. 83ed935790 shared: FileSaver: Return OK_WASEMPTY
We get OK_WASEMPTY from the processor when there
usually should be something. Rarely, this is not the case.

Let the callers know about this state at least
2022-06-24 19:17:50 +02:00
Albert S. 69837ed60f shared: SaveFileResult: Add OK_WASEMPTY when processor could not extract anything 2022-06-24 19:17:50 +02:00
Albert S. 2ad99699bf shared: FileSaver: Adjust to SandboxedProcessor new SaveFileResult value 2022-06-24 19:17:50 +02:00
Albert S. b6b3e2f3c0 shared SandBoxedProcessor: Return SaveFileResult, remove defines
Not entirely ideal as SandboxedProcessor does not save anything,
but an improvement nevertheless over the current mess
2022-06-24 19:17:50 +02:00
Albert S. cf0c940b15 shared: Move SaveFileResult enum to own header 2022-06-24 19:17:50 +02:00
Albert S. 780318db6d shared: Indexer: Consider new NOACCESS too 2022-06-24 19:17:50 +02:00
Albert S. 9fd48d4664 shared: FileSaver: Return NOACCESS when no read access 2022-06-24 19:17:50 +02:00
Albert S. e99b2ba091 shared: Indexer: IndexResult: Introduce failedResults() 2022-06-24 19:17:50 +02:00
Albert S. 0867ab294d shared: SandboxedProcessor: Return NO_ACCESS when file not readable 2022-06-24 19:17:50 +02:00
Albert S. 01a6a499c5 shared: SqliteDBService: Add 'NOACCESS'. Add function to convert enum to str 2022-06-24 19:17:50 +02:00
Albert S. e01f5d6490 shared: ParallelDirScanner: Perform first pass to collect paths
Scan the top directory to collect paths for the threads. This
way we don't launch threads for paths without subdirs. Secondly,
large trees like usually $HOME will be scanned by multiple threads
at first.

Nevertheless, ParallelDirScanner can be improved still as threads may
run quickly out of work, so we may end up with only one anyway again
2022-06-24 19:17:50 +02:00
Albert S. 759d2a7924 Fix builds with quazip 1.X
Sigh. quazip changed the lib name, include locations, etc. from version 1.
Some distributions only have 0.9. Some only  1.x and so some packages break,
so they simply patch it when building the package.

Luckily, nothing we use from quazip is affected from an API perspective.

So detect if there is quazip1, then use pkg-config to link that, else do it like before.
2022-06-21 22:33:50 +02:00
Albert S. bc908a1038 shared: LooqsQuery: Add unicode category class for numbers to regex 2022-06-14 10:15:17 +02:00
Albert S. 451c79088a shared/gui: Don't consider non-content search results for previews
Not entirely ideal, since we may want to search for 'cake', and look at
a preview for 'cake.txt' even if there is no 'cake' inside.

But this will do for now
2022-06-13 22:46:14 +02:00
Albert S. 1a39118470 shared: LooqsQuery: has*Search(): Mark methods const 2022-06-13 22:43:23 +02:00
Albert S. b108cb7151 shared: Indexer: Exclude 'excludedPaths' settings already at DirScanner, not only FileSaver 2022-06-13 21:57:34 +02:00