İşlemeleri karşılaştır
7 İşleme
Yazar | SHA1 | Tarih | |
---|---|---|---|
82cb6f76fa | |||
4aef3c42c2 | |||
c5cf04049f | |||
dca7fc6665 | |||
97c7ed13ab | |||
690e3ede27 | |||
894e478a29 |
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,29 +1,22 @@
|
||||
# looqs: Release notes
|
||||
|
||||
## 2022-06-06 - v0.1
|
||||
## 2022-06-XX - v0.1
|
||||
The first release comes with basic functionality. It's a start that can be considered useful to some degree.
|
||||
|
||||
looqs is still at an early stage and may exhibit some weirdness and contain bugs.
|
||||
|
||||
Tested architectures: amd64.
|
||||
|
||||
CHANGES:
|
||||
- CLI command "looqs" to add/update/delete and search
|
||||
- GUI: "looqs-gui" to search, render previews, and add files to index
|
||||
CHANGES:
|
||||
- CLI command "looqs" to add/update/delete and search
|
||||
- GUI: "looqs-gui" to search, render previews, and add files to index
|
||||
- General: Add multi-threaded indexing of all files (paths, mtime)
|
||||
- General: Generate sqlite based full-text search index for: .pdf,.odt,.ods, text files
|
||||
- General: Sandboxed content processing
|
||||
- GUI: Sandboxed IPC sub-process to render previews.
|
||||
- GUI: Add previews for pdf: Render the page the search keywords were found. Highlight the keywords when rendering the page.
|
||||
- GUI: Add previews for plaintext files: Extract snippets. Highlight the keywords when rendering the page.
|
||||
- GUI: Add previews for pdf: Render the page the search keywords were found. Highlight the keywords when rendering the page.
|
||||
- GUI: Add previews for plaintext files: Extract snippets. Highlight the keywords when rendering the page.
|
||||
- General: Add basic filters for query.
|
||||
- GUI: Add icon. Special thanks to the following sources:
|
||||
https://www.svgrepo.com/svg/151751/magnifier-with-small-handle
|
||||
https://www.svgrepo.com/svg/52764/open-book
|
||||
|
||||
Thanks!
|
||||
- General: Documentation.
|
||||
|
||||
- Add packages: Ubuntu 21.10, 22.04
|
||||
- Add packages: Ubuntu 22.04
|
||||
|
||||
Thanks to all those who provided feedback (and endured bugs) at various stages. You know who you are, thx!
|
||||
|
@ -1,26 +0,0 @@
|
||||
# looqs - Contributing
|
||||
Contributions are welcome, please use the following guidelines.
|
||||
|
||||
## Repository
|
||||
The github repository https://github.com/quitesimpleorg/looqs is the primary one. Pull-Requests and Issues go there, but you can also submit your feedback there.
|
||||
|
||||
Those who prefer a more classical approach can mail their patches etc. to looqs at quitesimple org. Ideally git-format patch and git send-email.
|
||||
|
||||
The repository at https://gitea.quitesimple.org/crtxcr/looqs was supposed to be the main one, but these
|
||||
plans are on hold for the time being. Just ignore it.
|
||||
|
||||
## Pull-Requests & Rebasing
|
||||
Your merge requests should be submitted against the dev branch. master branch won't be rebased. I'll try to avoid in the dev branch. I definitly rebase WIP/feature branches.
|
||||
|
||||
|
||||
## Commit messages
|
||||
Commit messages begin with the component your change affects, e. g. "gui:", "cli:", "shared:", followed by the class.
|
||||
Then choose an appropriate verb in present tense. Wrong: Fixed, Fixes. Correct: Fix. Make sure lines are not too long,
|
||||
I personally go by gut feeling in this matter.
|
||||
|
||||
If your change has an issue, link it at the end: Closes: https://github.com/quitesimpleorg/looqs/issues/1
|
||||
|
||||
Example: "shared: Indexer: Use WildcardMatcher to ignore paths"
|
||||
|
||||
## License
|
||||
You license your changes under the GPLv3 by contributing.
|
31
HACKING.md
31
HACKING.md
@ -1,31 +0,0 @@
|
||||
# looqs - Hacking
|
||||
|
||||
## Introduction
|
||||
Without elaborating here, I hacked looqs because I was not satisfied with the state of desktop search on Linux.
|
||||
|
||||
Originally a set of CLI python scripts, it is now written in C++ and offers a GUI made using Qt. While a "web app" would have been an option, I prefer a desktop application for something like looqs. I chose Qt because I am more familiar with it than with any other GUI framework. To my knowledge, potential alternatives like GTK do not include as many "batteries" as Qt anyway, so the job presumably would have been harder there.
|
||||
|
||||
[CONTRIBUTING.md](CONTRIBUTING.md) contains the instructions on how to submit patches etc.
|
||||
|
||||
## Security
|
||||
The architecture ensures that the parsing of documents and the preview generation is sandboxed by [exile.h](https://github.com/quitesimpleorg/exile.h). looqs uses a multi-process architecture to achieve this.
|
||||
|
||||
Qt code is considered trusted in this model. While one may critize this, it was the only practical solution. looqs uses its serialization mechanism and other classes to communicate between the non-sandboxed GUI process and the sandboxed processes.
|
||||
|
||||
## Database
|
||||
The heart is sqlite, with the FTS5 extensions behind the full-text search. I definitly did not
|
||||
want to run some heavy Java based solutions. I explored other options like Postgresql, I've discard them due to some limitations back then.
|
||||
|
||||
Down the road, alternatives will be explored of course if sqlite should not suffice anymore.
|
||||
|
||||
## File format support
|
||||
The pdf library is libpoppler. Files such as .odt or .docx documents are opened with libquazip. The XML files in there are not parsed,
|
||||
looqs simply strips the tags and that seems to work fine so far. Naturally, this is not the "proper way", so there is room for improvement maybehere. However, those file formats are not a huge priortiy for me personally. libuchardet does encoding detection and conversion.
|
||||
|
||||
Naturally looqs won't be able to index and render previews for everything. Such approach would create a huge bloated binary. In the future, there will be some plugin system of some sorts, either we will load .so objects or use subprocesses.
|
||||
|
||||
## Name
|
||||
looqs looks for files. You as the user can also look inside them. The 'k' was replaced by a 'q'. Originally wanted my projects to have "qs" (for quitesimple) in their name. While abandoned now, this got us to looqs.
|
||||
|
||||
|
||||
|
70
README.md
70
README.md
@ -2,35 +2,20 @@
|
||||
looqs is a tool that creates a full-text search index for your files. It allows you to look at previews where your
|
||||
search terms have been found, as shown in the screenshots below.
|
||||
|
||||
|
||||
## Screenshots
|
||||
The screenshots in this section may occasionally be slightly outdated, but they are usually recent enough to get an overall impression of the current state of the GUI.
|
||||
The screenshots in this section may occasionally be slightly outdated, but they are usually recent enough to get an overall impression of the current state.
|
||||
|
||||
### List
|
||||

|
||||
|
||||
### Preview
|
||||
looqs allow you to look inside files. It marks what you have searched for.
|
||||
|
||||

|
||||

|
||||
|
||||
### Results list
|
||||
#### Classic results list
|
||||
Just enter what you want to find, it will search paths and file content.
|
||||

|
||||
|
||||
#### Searching with filters
|
||||
You can be more specific to get what you want with filters
|
||||
|
||||
**Filters (long form)**
|
||||

|
||||
|
||||
**Filters (short form)**
|
||||
|
||||
There is no need to write the long form of filters. There are also booleans available
|
||||
|
||||

|
||||
|
||||
|
||||
## Current status
|
||||
Last version: 2022-06-06, v0.1
|
||||
Last version: 2022-0X-XX, v0.1
|
||||
|
||||
Please see [Changelog](CHANGELOG.md) for a human readable list of changes.
|
||||
|
||||
@ -38,20 +23,10 @@ Please see [Changelog](CHANGELOG.md) for a human readable list of changes.
|
||||
## Goals and principles
|
||||
* **Find & Preview**. Instead of merely telling you where your search phrase has been found, it should also render the corresponding portion/pages of the documents and highlight the searched words.
|
||||
* **No daemons**. As some other desktop search projects are prone to have annoying daemons running that eat system resources away, this solution should make do without daemons where possible.
|
||||
* **Easy setup**. Similarly, there should be no need for heavy-weight databases. Instead, looqs tries to squeeze out the most from simple approaches. In particular, it relies on sqlite.
|
||||
* **Easy setup**. Similiarly, there should be no need for heavy-weight databases. Instead, this solution tries to squeeze out the most from simple approaches. In particular, it relies on sqlite.
|
||||
* **GUI & CLI**. Provide CLI interfaces and GUI interfaces
|
||||
* **Sandboxing**. As reading and rendering lots of formats naturally opens the door for security bugs, those tasks are offloaded to small, sandboxed sub-processes to mitigate the effect of exploited vulnerabilities.
|
||||
|
||||
|
||||
## Features
|
||||
- GUI, CLI interface
|
||||
- Indexing of file path and some metadata.
|
||||
- Indexing of file file content for FTS search. Currently: .pdf, odt, docx, plaintext.
|
||||
- Preview of file formats: Currently: .pdf, plaintext
|
||||
- Highlight searched terms.
|
||||
- Quickly open PDF viewer or text editor at location of preview
|
||||
- Search filters
|
||||
|
||||
## Supported platforms
|
||||
Linux (on amd64) is currently the main focus. Currently, I don't plan on supporting anything else and the sandboxing architecture does not make it likely. I suppose a version without sandboxing might be conceivable for other platforms, but I have no plans or resources to actively target anything but Linux at this point.
|
||||
|
||||
@ -59,17 +34,15 @@ Linux (on amd64) is currently the main focus. Currently, I don't plan on support
|
||||
GPLv3.
|
||||
|
||||
### Contributing
|
||||
Please see the [Contribution guidelines](CONTRIBUTING.md) file.
|
||||
For now, github issues and pull-requests are preferred, but you can also just email
|
||||
your patches or issues to: looqs at quitesimple.org
|
||||
|
||||
## Documentation
|
||||
Please see [USAGE.md](USAGE.md) for the user manual. There is also [HACKING.md](HACKING.md) with more technical information.
|
||||
Please target the 'dev' branch in your pull request.
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
### Ubuntu 21.10/22.04
|
||||
|
||||
To build on Ubuntu and Debian, clone the repo and then run:
|
||||
```
|
||||
git submodule init
|
||||
git submodule update
|
||||
@ -80,22 +53,9 @@ make
|
||||
|
||||
The GUI is located in `gui/looqs-gui`, the binary for the CLI is in `cli/looqs`
|
||||
|
||||
|
||||
## Documentation
|
||||
Please see [USAGE.md](USAGE.md) for the user manual.
|
||||
|
||||
## Packages
|
||||
At this point, looqs is not in any official distro package repo, but I maintain some packages.
|
||||
|
||||
### Ubuntu 21.10/22.04
|
||||
Latest release can be installed using apt from the repo.
|
||||
```
|
||||
# First, obtain key, assume it's trusted.
|
||||
wget -O- https://repo.quitesimple.org/repo.quitesimple.org.asc | gpg --dearmor > repo.quitesimple.org-keyring.gpg
|
||||
cat repo.quitesimple.org-keyring.gpg | sudo tee -a /usr/share/keyrings/repo.quitesimple.org.gpg > /dev/null
|
||||
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/repo.quitesimple.org.gpg] https://repo.quitesimple.org/debian/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/quitesimple.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install looqs
|
||||
```
|
||||
|
||||
### Other distros
|
||||
I'll probably add a package for voidlinux at some point and maybe will provide a Gentoo ebuild. However, I would appreciate help for others distros. If you create a package, let me know!
|
||||
|
||||
As for distro-agnostic packages, I will also take a look into appimage / flatpak etc. and/or maybe just provide a self-contained archive.
|
||||
Coming soon™
|
||||
|
@ -29,12 +29,8 @@ void CommandAdd::indexerFinished()
|
||||
}
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
if(!keepGoing && failedPathsCount > 0)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
emit finishedCmd(ret);
|
||||
/* TODO maybe not 0 if keepGoing not given */
|
||||
emit finishedCmd(0);
|
||||
}
|
||||
|
||||
int CommandAdd::handle(QStringList arguments)
|
||||
@ -44,13 +40,15 @@ int CommandAdd::handle(QStringList arguments)
|
||||
"Continue adding files, don't exit on first error. If this option is not given, looqs will "
|
||||
"exit asap, but it's possible that a few files will still be processed. "
|
||||
"Set -t 1 to avoid this behavior, but processing will be slower. "},
|
||||
{{"v", "verbose"}, "Print skipped and added files"},
|
||||
{{"t", "threads"}, "Number of threads to use.", "threads"}});
|
||||
|
||||
parser.addHelpOption();
|
||||
parser.addPositionalArgument("add", "Add paths to the index", "add [paths...]");
|
||||
|
||||
parser.process(arguments);
|
||||
this->keepGoing = parser.isSet("continue");
|
||||
bool keepGoing = parser.isSet("continue");
|
||||
bool verbose = parser.isSet("verbose");
|
||||
if(parser.isSet("threads"))
|
||||
{
|
||||
QString threadsCount = parser.value("threads");
|
||||
@ -72,15 +70,17 @@ int CommandAdd::handle(QStringList arguments)
|
||||
|
||||
indexer = new Indexer(*this->dbService);
|
||||
indexer->setTargetPaths(files.toVector());
|
||||
indexer->setKeepGoing(keepGoing);
|
||||
|
||||
connect(indexer, &Indexer::pathsCountChanged, this,
|
||||
[](int pathsCount) { Logger::info() << "Found paths: " << pathsCount << Qt::endl; });
|
||||
|
||||
connect(indexer, &Indexer::indexProgress, this,
|
||||
[](int pathsCount, unsigned int added, unsigned int skipped, unsigned int failed, unsigned int totalCount)
|
||||
{ Logger::info() << "Processed files: " << pathsCount << Qt::endl; });
|
||||
connect(indexer, &Indexer::finished, this, &CommandAdd::indexerFinished);
|
||||
|
||||
/* TODO: keepGoing, verbose */
|
||||
|
||||
this->autoFinish = false;
|
||||
indexer->beginIndexing();
|
||||
|
||||
|
@ -10,7 +10,6 @@ class CommandAdd : public Command
|
||||
private:
|
||||
SaveFileResult addFile(QString path);
|
||||
Indexer *indexer;
|
||||
bool keepGoing = true;
|
||||
|
||||
protected:
|
||||
public:
|
||||
|
@ -78,4 +78,4 @@ else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PW
|
||||
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../shared/debug/shared.lib
|
||||
else:unix: PRE_TARGETDEPS += $$OUT_PWD/../shared/libshared.a
|
||||
|
||||
RESOURCES = ../looqs.svg
|
||||
RESOURCES = ../icon.svg
|
||||
|
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
QApplication a(argc, argv);
|
||||
a.setWindowIcon(QIcon(":/looqs.svg"));
|
||||
a.setWindowIcon(QIcon(":/icon.svg"));
|
||||
QObject::connect(&a, &QApplication::aboutToQuit, &process, &QProcess::kill);
|
||||
|
||||
qRegisterMetaType<QVector<SearchResult>>("QVector<SearchResult>");
|
||||
|
@ -502,7 +502,7 @@ void MainWindow::makePreviews(int page)
|
||||
scaleText.chop(1);
|
||||
|
||||
QVector<QString> wordsToHighlight;
|
||||
QRegularExpression extractor(R"#("([^"]*)"|(\p{L}+))#");
|
||||
QRegularExpression extractor(R"#("([^"]*)"|(\w+))#");
|
||||
for(const Token &token : this->contentSearchQuery.getTokens())
|
||||
{
|
||||
if(token.type == FILTER_CONTENT_CONTAINS)
|
||||
|
Önce Genişlik: | Yükseklik: | Boyut: 13 KiB Sonra Genişlik: | Yükseklik: | Boyut: 13 KiB |
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Name=looqs
|
||||
Exec=looqs-gui
|
||||
Exec=/usr/bin/looqs-gui
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=looqs
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define SETTINGS_KEY_IPCSOCKETPATH "ipcsocketpath"
|
||||
#define SETTINGS_KEY_PDFVIEWER "pdfviewer"
|
||||
#define SETTINGS_KEY_EXCLUDEDPATHS "excludedpaths"
|
||||
#define SETTINGS_KEY_MOUNTPATHS "mountpaths"
|
||||
|
||||
inline void initResources()
|
||||
{
|
||||
@ -181,32 +180,6 @@ QStringList Common::excludedPaths()
|
||||
return ::excludedPaths;
|
||||
}
|
||||
|
||||
QStringList Common::mountPaths()
|
||||
{
|
||||
static int ran = false;
|
||||
static QStringList mountPaths;
|
||||
if(!ran)
|
||||
{
|
||||
QSettings settings;
|
||||
mountPaths = settings.value(SETTINGS_KEY_MOUNTPATHS, QStringList{"/media", "/mnt"}).toStringList();
|
||||
ran = true;
|
||||
}
|
||||
return mountPaths;
|
||||
}
|
||||
|
||||
bool Common::isMountPath(QString path)
|
||||
{
|
||||
QStringList mountPaths = Common::mountPaths();
|
||||
for(QString &mountPath : mountPaths)
|
||||
{
|
||||
if(path.startsWith(mountPath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Common::isTextFile(QFileInfo fileInfo)
|
||||
{
|
||||
/* TODO: This is not sandboxed yet ... */
|
||||
|
@ -12,9 +12,7 @@ QString findInPath(QString needle);
|
||||
bool initSqliteDatabase(QString path);
|
||||
void ensureConfigured();
|
||||
QStringList excludedPaths();
|
||||
QStringList mountPaths();
|
||||
bool isTextFile(QFileInfo fileInfo);
|
||||
bool isMountPath(QString path);
|
||||
QString versionText();
|
||||
} // namespace Common
|
||||
#endif
|
||||
|
@ -36,14 +36,10 @@ void Indexer::beginIndexing()
|
||||
this->filePathTargetsQueue.enqueue(path);
|
||||
}
|
||||
}
|
||||
this->dirScanner->setPaths(dirs);
|
||||
this->dirScanner->setIgnorePatterns(this->ignorePattern);
|
||||
|
||||
if(!dirs.empty())
|
||||
{
|
||||
this->dirScanner->setPaths(dirs);
|
||||
this->dirScanner->setIgnorePatterns(this->ignorePattern);
|
||||
|
||||
this->dirScanner->scan();
|
||||
}
|
||||
this->dirScanner->scan();
|
||||
|
||||
this->workerCancellationToken.store(false, std::memory_order_seq_cst);
|
||||
launchWorker(this->filePathTargetsQueue, this->filePathTargetsQueue.remaining());
|
||||
@ -59,16 +55,6 @@ void Indexer::setTargetPaths(QVector<QString> pathsToScan)
|
||||
this->pathsToScan = pathsToScan;
|
||||
}
|
||||
|
||||
void Indexer::setVerbose(bool verbose)
|
||||
{
|
||||
this->verbose = verbose;
|
||||
}
|
||||
|
||||
void Indexer::setKeepGoing(bool keepGoing)
|
||||
{
|
||||
this->keepGoing = keepGoing;
|
||||
}
|
||||
|
||||
void Indexer::requestCancellation()
|
||||
{
|
||||
this->dirScanner->cancel();
|
||||
@ -82,7 +68,7 @@ IndexResult Indexer::getResult()
|
||||
|
||||
void Indexer::dirScanFinished()
|
||||
{
|
||||
Logger::info() << "Dir scan finished" << Qt::endl;
|
||||
Logger::info() << "Dir scan finished";
|
||||
if(!isRunning())
|
||||
{
|
||||
emit finished();
|
||||
@ -106,24 +92,17 @@ void Indexer::dirScanProgress(int current, int total)
|
||||
|
||||
void Indexer::processFileScanResult(FileScanResult result)
|
||||
{
|
||||
if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND)
|
||||
if(verbose)
|
||||
{
|
||||
this->currentIndexResult.results.append(result);
|
||||
if(!keepGoing)
|
||||
{
|
||||
this->requestCancellation();
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(verbose)
|
||||
if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND)
|
||||
{
|
||||
this->currentIndexResult.results.append(result);
|
||||
}
|
||||
}
|
||||
|
||||
if(result.second == OK)
|
||||
{
|
||||
++this->currentIndexResult.addedPaths;
|
||||
|
@ -67,8 +67,6 @@ class Indexer : public QObject
|
||||
void beginIndexing();
|
||||
void setIgnorePattern(QStringList ignorePattern);
|
||||
void setTargetPaths(QVector<QString> pathsToScan);
|
||||
void setVerbose(bool verbose);
|
||||
void setKeepGoing(bool keepGoing);
|
||||
|
||||
void requestCancellation();
|
||||
|
||||
|
@ -55,11 +55,6 @@ void IndexSyncer::sync()
|
||||
emit finished(totalUpdatesFilesCount, totalDeletedFilesCount, totalErroredFilesCount);
|
||||
return;
|
||||
}
|
||||
if(Common::isMountPath(fileData.absPath))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(fileData.absPath);
|
||||
if(fileInfo.exists())
|
||||
{
|
||||
|
@ -180,9 +180,8 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b
|
||||
|
||||
QStringList loneWords;
|
||||
LooqsQuery result;
|
||||
QRegularExpression rx(
|
||||
"((?<filtername>(\\.|\\w)+):(?<args>\\((?<innerargs>[^\\)]+)\\)|([\\p{L},])+)|(?<boolean>AND|OR)"
|
||||
"|(?<negation>!)|(?<bracket>\\(|\\))|(?<loneword>[\"\\p{L}]+))");
|
||||
QRegularExpression rx("((?<filtername>(\\.|\\w)+):(?<args>\\((?<innerargs>[^\\)]+)\\)|([\\w,])+)|(?<boolean>AND|OR)"
|
||||
"|(?<negation>!)|(?<bracket>\\(|\\))|(?<loneword>[\"\\w]+))");
|
||||
QRegularExpressionMatchIterator i = rx.globalMatch(expression);
|
||||
auto previousWasBool = [&result] { return !result.tokens.empty() && ((result.tokens.last().type & BOOL) == BOOL); };
|
||||
auto previousWas = [&result](TokenType t) { return !result.tokens.empty() && (result.tokens.last().type == t); };
|
||||
|
Submodule submodules/exile.h updated: 42d44b0cc1...bbbdfc44da
Yeni konuda referans
Bir kullanıcı engelle