Commit Graph

456 Commits

Author SHA1 Message Date
31f0568a87 shared: LimitQueue: Change limit type to int
More consistent with "QQueue::size()" and silences warning
2022-08-28 13:10:39 +02:00
238f9add49 gui: Set a more reasonable maximum width for previews
They won't be this large but in particular for vertical scroll,
this makes way more sense.
2022-08-28 13:05:33 +02:00
7c63ee9178 gui: mainwindow: Set center alignment for previews
Noticable now that we have vertical scrolling
2022-08-28 13:04:06 +02:00
1edfcc8f23 gui: PreviewGeneratorPlainText: Escape html before working on text
We use this semi-HTML mode to highlight words, but if we already
have tags in the document this does not work quite well.

Thus, escape the string before further processing it
2022-08-28 13:01:46 +02:00
2df273dee3 gui: PreviewGenerator*: Fallback to partial highlighting if no whole word match 2022-08-28 12:44:42 +02:00
5a47f5949f gui: PreviewGeneratorPlainText: Rework snippets selection
The current snippet selection is useless for many queries.

Attempt a more reasonable snippet selection by prioritizing
those where all words are contained. The more words a snippet
has, the more important it is considered.Therefore, those will
be at the top.

Only highlight whole words
2022-08-27 22:18:43 +02:00
e6a0c0daee gui: PreviewGeneratorPdf: Only highlight whole words
Only highlight whole words, which is less confusing
2022-08-27 22:17:10 +02:00
11b070ed42 gui: mainwindow: Improve preview status reporting
Better represent the state of available previews.

Only add paths to ui->comboPreviewFiles once
2022-08-27 12:04:35 +02:00
47874b3706 gui: ipcworker,ipcserver: Refactor
Crashes were observed, faulting in libQtNetwork.
Those were rather rare. We also have no traces.

Probably depends on some order signal/slots were
processed. Remove shared states between connections,
such as the IPCPreviewWorker and socket instance in IPCServer.
2022-08-27 11:15:45 +02:00
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
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
d8205a0da4 gui: Disable search box as long as previews are being generated
Otherwise "spamming" queries can cause high load and
many outstanding may arrive only to be discarded anyway
for not being part of the recent query.
2022-08-23 17:37:05 +02:00
877224b6e1 gui: mainwindow: Only trigger preview generation when in tab
Indirectly generation would fire when we set combobox index
programitcally. So it's slot should only trigger the generation
when the user is viewing the preview tab
2022-08-23 17:35:52 +02:00
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
fe610d3068 mainwindow: Allow CTRL + mouse wheel to zoom on previews 2022-08-21 18:42:32 +02:00
0c1b57d911 mainwindow: Save/Restore history 2022-08-21 17:48:43 +02:00
2885e40a3a mainwindow: Add search history. Allow going up/down with arrow keys 2022-08-21 17:47:11 +02:00
c0f4087937 sqlitesearch: escapeFtsArgument: Fix handling of '*' prefix search
The * must not be in quotes
2022-08-21 07:55:49 +02:00
46c52afe59 Release v0.6 2022-08-14 23:15:19 +02:00
431abfe7c0 USAGE.md: Update 2022-08-14 20:28:17 +02:00
47c19d121a gui: mainwindow: Add CTRL(+Shift+)Tab shortcut to switch between tabs 2022-08-14 20:25:44 +02:00
166c051cfb gui: mainwindow: Add CTRL+F and CTRL+W shortcuts
Add shortcuts to make entering queries more efficient

CTRL+F: Highlights rightmost filter, e. g. c:(word1 word2) would
highlight everything between (), so "word1 word" here. Alternatively,
highlights lone words, so p:(docs) word1, would highlight word1.

CTRL+W: Removes last filter or words.
2022-08-14 20:25:44 +02:00
47d0440ffb gui: mainwindow: Add checkbox to remove current database 2022-08-14 20:25:44 +02:00
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
eb58b8f770 gui: Clear previews always on new search results
If a first search generates previews and the next one does
not, old entries would still have been visible.

So we just clear them once we get results.
2022-08-06 10:10:45 +02:00
9a70a821bd gui: PreviewGeneratorPlainText: Show line numbers
Generate previews that show the line number and surrounding
lines (like grep -C) for context.
2022-08-06 10:01:24 +02:00
89bf65d9bb gui: PreviewGeneratorPlaintext: Add MAX_SNIPPETS const, remove redundant loop 2022-08-06 09:35:00 +02:00
ad06497b4b shared: Add LimitQueue which discards oldest entry once limit hit 2022-08-06 09:06:00 +02:00
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
e8b89b77ab Release v0.5.1 2022-07-30 10:11:44 +02:00
77f5c7e39d gui: mainwindow: Revert pathsQuery to original behaviour
Since 7c5c91e we wrongly merge lone words for paths queries too.
This creates unintended behaviour.

Fix it by creating a new paths query without merged words, which
restores the original behaviour.

Also, get rid of some redundant calls to createFinalTokens()
2022-07-30 10:01:51 +02:00
052f169ef2 Release v0.5 2022-07-29 10:17:04 +02:00
ffdb326045 USAGE.md: Update 2022-07-29 10:17:04 +02:00
7c5c91ef10 gui: search: Avoid double results + minor improvements
Avoid double results in search by distinguishing whether
a filter was explicitly given. Previously, we could not
discern this.

Furthermore, if a content search is given, lone words will be
considered path searches. If a path search is given, we consider
lone words implicit content search filters. This simplifies
queries for the user
2022-07-29 10:17:04 +02:00
076c3c4c7f shared: LooqsQuery: Add implicit AND also for lone words 2022-07-29 10:17:04 +02:00
c11fd1a9ff shared: LooqsQuery: Allow constructing from tokens and sort conditions 2022-07-29 10:17:04 +02:00
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
1188e51c35 cli: Run migrations if necessary 2022-07-28 14:28:45 +02:00
1da8344295 shared: Adjust queries to db revision 2 2022-07-28 14:00:46 +02:00
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
7fa266e5e8 gui: main: Execute migrations. Show migration progress dialog
We don't do silent upgrades anymore because they might take considerable
time.
2022-07-28 13:43:02 +02:00
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
49b57e1740 shared: DBMigrator: Take DatabaseFactory, run vacuum, add error() sig, start() slot 2022-07-28 13:27:37 +02:00
5996971195 shared: common: setPdfViewer(): Fix misplaced QSettings 2022-07-24 23:57:38 +02:00
bf1265fe3a shared: Retire Common::findInPath() for builtin Qt function 2022-07-24 18:19:38 +02:00
43a0f08579 gui: PreviewGeneratorPlainText: Fix case of empty preview when word found on pos 0 2022-07-24 12:25:38 +02:00
1aa5ae0ccc gui: Introduce PreviewGeneratorOdt for basic previews of .odt files 2022-07-24 11:43:00 +02:00
20d42a66a6 gui: Begin PreviewResultOdt 2022-07-24 11:41:25 +02:00
cba4df3eac gui: previews: Add label with file path below every preview 2022-07-24 11:40:38 +02:00
fdbf3a7358 gui: PreviewGeneratorPlainText: Move snippet gen to own function for reuse 2022-07-24 11:34:52 +02:00