Commit Graph

159 Commits

Author SHA1 Message Date
bf1265fe3a shared: Retire Common::findInPath() for builtin Qt function 2022-07-24 18:19:38 +02:00
ab064c3e3b gui: mainwindow: Add menu action to open web user manual 2022-07-23 20:16:19 +02:00
cc9dae37e5 shared: Indexer: Use isErrorSaveFileResult() to check for non-successful results 2022-07-11 17:14:45 +02:00
64a9638d1e shared: SaveFileResult: Introduce isErrorSaveFileResult() 2022-07-11 17:13:58 +02:00
5ffd7ae97e shared: common: setPdfViewer(): Fix missing spaces between viewer and args 2022-06-29 19:31:40 +02:00
990888efc1 shared: Include license texts as resource 2022-06-29 18:00:05 +02:00
1636e39c5b shared: ParallelDirScanner: Fix missing progress report from top-level scan 2022-06-27 23:11:26 +02:00
bda23670e3 shared: ParallelDirScanner: Correct filter to 'NoDotAndDotDot' from 'NoDotDot' 2022-06-27 23:10:53 +02:00
a561032668 shared: Indexer: Adjust for OK_WASEMPTY 2022-06-24 19:17:50 +02:00
b8006bde7b shared: FileSaver: Don't launch SandboxedProcessor for empty files 2022-06-24 19:17:50 +02:00
614238edda shared: FileSaver: Print message for OK_WASEMPTY 2022-06-24 19:17:50 +02:00
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
69837ed60f shared: SaveFileResult: Add OK_WASEMPTY when processor could not extract anything 2022-06-24 19:17:50 +02:00
2ad99699bf shared: FileSaver: Adjust to SandboxedProcessor new SaveFileResult value 2022-06-24 19:17:50 +02:00
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
cf0c940b15 shared: Move SaveFileResult enum to own header 2022-06-24 19:17:50 +02:00
780318db6d shared: Indexer: Consider new NOACCESS too 2022-06-24 19:17:50 +02:00
9fd48d4664 shared: FileSaver: Return NOACCESS when no read access 2022-06-24 19:17:50 +02:00
e99b2ba091 shared: Indexer: IndexResult: Introduce failedResults() 2022-06-24 19:17:50 +02:00
0867ab294d shared: SandboxedProcessor: Return NO_ACCESS when file not readable 2022-06-24 19:17:50 +02:00
01a6a499c5 shared: SqliteDBService: Add 'NOACCESS'. Add function to convert enum to str 2022-06-24 19:17:50 +02:00
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
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
bc908a1038 shared: LooqsQuery: Add unicode category class for numbers to regex 2022-06-14 10:15:17 +02:00
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
1a39118470 shared: LooqsQuery: has*Search(): Mark methods const 2022-06-13 22:43:23 +02:00
b108cb7151 shared: Indexer: Exclude 'excludedPaths' settings already at DirScanner, not only FileSaver 2022-06-13 21:57:34 +02:00
8a82da95bd shared: common: Retire 'firstrun' settings logic 2022-06-13 21:57:34 +02:00
dd479fa668 gui: Add 'Settings' tab 2022-06-13 21:57:34 +02:00
e76988ee77 shared: SandboxedProcessor: Enable fallback for non-landlock systems
Unless it's a processor that does not need fs access, this would
fail on systems without landlock, so we must fallback to
chroot() etc. again.
2022-06-09 10:04:48 +02:00
87ebc137d5 shared/gui: Add LOOQS_DISABLE_SANDBOX env to allow disabling sandboxing
Mainly for devs to check whether a problem is caused by sandboxing.
2022-06-06 23:23:07 +02:00
f8542dc96a shared: Indexer: Handle keepGoing, set verbose 2022-06-06 09:34:37 +02:00
fdae7fd065 shared: LooqsQuery: Use unicode category class in regex 2022-06-06 09:34:37 +02:00
61fa7ca16d shared: IndexSyncer: Check whether file is located in a mountpath 2022-06-06 09:34:37 +02:00
61a446ec2d shared: common: Add mountPaths()
Mountpaths indicate mount points of external devices. Files
located under such paths should not be removed on sync, because
they may have not been deleted, but are just inaccessible right now.
2022-06-06 09:34:37 +02:00
0e5abf96c8 shared: indexer: Don't dispatch DirScanner if no dirs given
This makes sense in general, however it also avoids a race condition.

The dirscanner may finish before the filescanworkers for the files
run, this then signals the whole indexer has finished.
2022-06-05 20:35:21 +02:00
e5e43c8bfb shared: SqliteSearch: Append LIMIT statement if need be 2022-06-05 14:39:57 +02:00
a6ddcef0c0 shared: LooqsQuery: Fix logic of implicit AND booleans. Add 'limit:' support
Add implicit AND booleans at the end.

This fixes a number of issues in LooqsQuery:

(1) A query like a b c p:(something) would fail, because
a b c get merged into one word. This happens at the end.

lonewords are special and do not become a token immediatly. So previous
logic to add implicit ANDs does not apply.

(2) Negations were also broken with lonewords.

(3) The TokenType enum fields were too narrow to be useful for the bitmask

Independent of that, add support for 'limit:'
2022-06-05 14:39:57 +02:00
821bed6706 shared: LooqsQuery: Add 'p', 'pb', 'pe' aliases
Because this way the user has to type significantly less
2022-06-05 14:39:57 +02:00
d7b93d11d8 shared: IndexSyncer: Support cancellation 2022-06-04 17:09:26 +02:00
7d9c883abd shared: LooqsQuery: build(): Return empty query for empty expresion 2022-06-04 17:09:26 +02:00
abc126548b shared: Introduce IndexSyncer, containing logic of cli/CommandUpdate
IndexSyncer contains most of the logic of cli/CommandUpdate, so
it can be reused in the GUI where we need it too
2022-06-04 17:09:26 +02:00
86d629c957 shared: SqliteDbService: Changed getFiles() return to unsigned int 2022-06-04 17:09:26 +02:00
05fad3be17 shared: ParallelDirScanner: Delete DirScanWorkers after they are done 2022-06-04 17:09:26 +02:00
6f11a5e662 shared: FileSaver: Adjust message as it's confusing on updates 2022-06-04 17:09:26 +02:00
db029dd915 shared: shared.pro: Add git commit id to build 2022-06-04 17:09:26 +02:00
f14e2e77cd shared: common: Add versionText() function 2022-06-04 17:09:26 +02:00
15615776d3 shared: SandboxedProcessor: Fix scope issue with readablePathLocation
The pointer becomes invalid as readablePathLocation falls out of scope,
and exile.h quits with an error.

This may indicate exile API sucks, so something to think about there.
2022-06-04 17:09:26 +02:00
c2bd1b526b shared: Indexer: Use WildcardMatcher to ignore paths 2022-06-04 17:09:26 +02:00
a3666f283e shared: DirscanWorker: Use WildcardMatcher to ignore paths 2022-06-04 17:09:26 +02:00
edc41d6f59 shared: Introduce WildcardMatcher 2022-06-04 17:09:26 +02:00
26c7cdbc5f shared: Move textfile detector to common 2022-06-04 17:09:26 +02:00
aed0ca31f7 shared: SandboxedProcessor: Perform MIME-type detection
Detect mime types, and for text/*, run the default text processor.

The added benefit is that we can now add plaintext files without extensions,
or many other text files (e. g. source code).
2022-06-04 17:09:26 +02:00
b6926d510f FileSaver: Don't add files in blacklisted paths
We now resolve symlinks when adding, so we can properly check
whether a path is excluded or not. This accidently also
helps with duplicates.

Excluded paths are hardcoded and can also be appended to
by the user using the settings.

Closes: #34
2022-06-04 17:09:26 +02:00
ad0fc74439 ipc: Place socket in /tmp/.looqs/, remove ipc path settings 2022-05-29 11:20:28 +02:00
4a492fb356 shared: ParallelDirScanner: Remove leftover debug output 2022-04-28 23:45:56 +02:00
def766ba67 shared: common: On first start, try to set a rasonable pdfviewer value
May not be users default, but better than nothing for now.

Issue: #27
2022-04-25 23:01:11 +02:00
0d01fa977d shared: LooqsQuery: Consider " a part of the loneword
Strictly speaking a hack, and we may probably need to
add more chars here.

This mainly fixes the difference between:

"one two"
and c:("one two")

In the first case they are "lonewords", the " does
not get picked up. Then, the search results are something
not expected.
2022-04-25 22:27:46 +02:00
9b51e00737 Rename leftovers that were forgotten in 645903ed6b 2022-04-24 19:40:43 +02:00
84e13e432b shared: common: Introduce ipcSocketPath() 2022-04-24 15:52:20 +02:00
e8f095f821 shared: sqlitedbservice: Call prepare(), don't pass query in constructor for consistency 2022-04-24 15:52:20 +02:00
c99827e854 shared: FileScanWorker: Catch correct exception type 2022-04-24 15:52:20 +02:00
e3440beae7 shared: sqlitesearch: Avoid joining content table more than once 2022-04-24 15:52:20 +02:00
8194476fa6 shared: sqlitesearch: Only order by rank if token is FILTER_CONTENT_CONTAINS 2022-04-24 15:52:20 +02:00
45de97d8fb gui: Begin cancellation of Indexer 2022-04-24 15:52:20 +02:00
1cc7053193 shared: Update shared.pro with recent additions 2022-04-15 21:06:56 +02:00
c51fd3c555 shared: FileSaver: Return NOTFOUND, Handle NOTHING_PROCESSED exit code correctly 2022-04-15 21:06:56 +02:00
715023a3ee shared: FileSaver: Make addFile(),updateFile() public 2022-04-15 21:06:56 +02:00
4234967ef5 shared: Add NOTFOUND SaveFileResult 2022-04-15 21:06:56 +02:00
d483d05db1 shared: Begin Indexer 2022-04-15 21:06:56 +02:00
564b5ddae8 shared: Begin FileScanWorker 2022-04-15 21:06:56 +02:00
d7705241ee shared: Begin ParallelDirScanner 2022-04-15 21:06:56 +02:00
f3fbf4a1dc shared: Begin DirScanWorker 2022-04-15 21:06:56 +02:00
56414ee5e2 shared: Begin basic ConcurrentQueue 2022-04-15 21:06:56 +02:00
478d57b342 cli: Move most classes to shared lib for reuse 2022-04-15 21:06:56 +02:00
d43c35819d common: Use DBMigrator to init and update database 2022-04-15 21:06:56 +02:00
3d8b086f53 shared: Begin db migration logic
Issue: #26
2022-04-15 21:06:56 +02:00
294455b861 DatabaseFactory: Move to /shared 2022-04-15 21:06:56 +02:00
7066cc1a45 Logger: Move to shared/ 2022-02-27 23:10:46 +01:00
c0657947b1 LooqsQuery: Add hasContentSearch(),hasPathSearch() convenience functions 2022-01-04 11:24:37 +01:00
1f35e2120e LooqsQuery::build(): Ensure values are non-empty and ignore empty lone words 2022-01-04 11:24:37 +01:00
407ee1210c gui: Perform content search and path search by default
Search for content and paths. Merge lone words for content search.

This behaviour is much more natural than typing "c:()".
2022-01-03 23:14:55 +01:00
88ee2383f7 Switch to exile.h 2022-01-01 17:58:52 +01:00
b1f3e95622 shared: looksquery: Fix incorrect varname in exception 2022-01-01 17:58:52 +01:00
890925929a GUI: Begin IPC mechanism to open files despite sandboxing 2022-01-01 17:58:52 +01:00
01872e37d5 Add missing paranthesis
Not sure how these slipped through.
2021-06-12 22:51:22 +02:00
248bfb96fe shared: LooksQuery: init tokensMask with 0 to be sure 2021-06-12 22:48:59 +02:00
414d53e59a shared: create.sql: Fix format
The qt sqlite3 driver only accepts a single statement
per exec().

We can't split by ; due to the trigger statements.

Thus, the pragmatic and dirty solution is to simply
put a query per line.
2021-06-12 17:29:13 +02:00
604d45afb2 shared: common: Remove redundant qDebug() 2021-06-12 17:24:47 +02:00
e97551be97 Rename all symbols to new project name 2021-06-12 14:59:58 +02:00
645903ed6b README: Rename project from 'qss' to 'looqs' 2021-06-12 14:57:26 +02:00
e88d0e57b2 shared: qssquery: Fix sqlerror if sort condition comes last
If we had something like c:(test) sort:(mtime, desc), then
we would run into an sql error eventually, since we
would have added an implicit AND token before the sort
condition. This is wrong, as a sort is not a filter.

So, as a quick hack to fix this, just remove a preceeding
boolean (as dirty as it may be, but it does the job for now).
2021-03-07 22:54:24 +01:00
ee4fe51a77 shared: sqlitesearch: Remove subquery for content search
The subquery only works for boolean retrieval, its
ordering is irrelevant. Thus, use INNER JOIN instead
and order by rank by default.
2021-03-07 22:27:48 +01:00
64b87dd595 shared: qssquery: checkParanthesis(): Ignore paranthesis in quotes
Fixes #12
2020-12-19 12:52:40 +01:00
33b145e6d2 shared: sqlitesearch: Order by rank by default for content search
Making ranked results the default makes (obviously) more sense for
content search.
2020-12-19 12:42:28 +01:00
ef78e74cdd Detect first run and initialize database and config
Relates to #1
2020-08-24 21:36:45 +02:00
7c1e12d589 Ship database creation script as embedded resource 2020-08-24 21:33:56 +02:00
8de07b703c Add Common::databasePath which also allows overriding it 2020-05-24 15:36:27 +02:00
13fb901044 added Common namespace. cli: use settings instead of env for db path 2020-05-23 22:52:42 +02:00
f64362ac63 cli: search: implement -r, cleanup of options that don't belong there 2019-08-19 21:09:03 +02:00