-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support start anything server by systemd service On V20 system, the service will keep disable status, and the anything server will be started by dde-file-manager-daemon. On V25 system, the service will keep enable status. Log: support start anything server by systemd service Bug: https://pms.uniontech.com/bug-view-281871.html * chore: bump version 6.2.0 bump version Log: bump version * refactor: Refactor and address performance issues This update involves a complete refactor of the project, resolving critical issues such as high CPU usage, real-time event processing, and data integrity. The program's scalability, reusability, and flexibility have been significantly improved. * chore: Remove ignored files Removed files that are listed in .gitignore to keep the repository clean. * fix: dependency issue As title * fix: dependency issue As title * fix: tag confict As title * fix: add DBus connection and service registration checks Improved error handling and logging for failed DBus operations. * fix: resolve thread synchronization issues with the log module by switching to spdlog, add non-delayed disk scanning interface Resolved multi-threading conflicts in log output by replacing the logging module with the spdlog library, which supports multi-threading. By default, disk scanning uses delayed indexing to reduce CPU usage, but indexing speed is slower. Added an interface to disable delayed indexing. * fix: cppcheck error As title * feat: Adapt to v20 interface Adapt the old interface so that DDE File Manager and DDE Grand Search remain unaffected by the new version of Anything on v20. * feat: Improve tokenizer for more accurate path tokenization Enhanced support for AnythingAnalyzer and AnythingTokenizer, resulting in more precise tokenization of paths. * feat: Advanced search functionality Added support for searching by type and time range. * feat: Add syntax highlighting for keywords in search results Implemented support for highlighting keywords in the search results, enhancing readability and user experience. --------- Co-authored-by: rong wang <[email protected]>
- Loading branch information
1 parent
55e3967
commit 0ad4cfb
Showing
24 changed files
with
1,296 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
hello | ||
world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Programming Language Files | ||
.cpp=text/c++ | ||
.cxx=text/c++ | ||
.cc=text/c++ | ||
.c=text/c | ||
.h=text/c | ||
.hpp=text/c++ | ||
.cs=text/csharp | ||
.java=text/java | ||
.py=text/python | ||
.js=application/javascript | ||
.ts=application/typescript | ||
.html=text/html | ||
.css=text/css | ||
.php=application/php | ||
.rb=text/ruby | ||
.go=text/go | ||
.swift=text/swift | ||
.kt=text/kotlin | ||
.rs=text/rust | ||
.lua=text/lua | ||
.sh=application/shellscript | ||
.bash=application/shellscript/shell/bash | ||
.pl=text/perl | ||
.sql=application/sql | ||
.json=application/json | ||
.xml=application/xml | ||
.yaml=text/yaml | ||
.toml=text/toml | ||
.md=text/markdown | ||
.r=text/r | ||
.jl=text/julia/jl | ||
.dart=text/dart | ||
.scala=text/scala | ||
.vb=text/vb | ||
.asm=text/assembly/asm | ||
.bat=application/batch | ||
.make=text/makefile | ||
.cmake=text/cmake | ||
.gradle=text/gradle | ||
.dockerfile=text/dockerfile | ||
|
||
# Document Files | ||
.txt=text/plain/txt | ||
.pdf=application/pdf | ||
.doc=application/doc | ||
.docx=application/docx | ||
.xls=application/xls | ||
.xlsx=application/xlsx | ||
.ppt=application/ppt | ||
.pptx=application/pptx | ||
|
||
# Image Files | ||
.jpg=image/jpeg/jpg | ||
.jpeg=image/jpeg | ||
.png=image/png | ||
.gif=image/gif | ||
.bmp=image/bmp | ||
.svg=image/svg+xml | ||
.ico=image/vnd.microsoft.icon | ||
|
||
# Audio Files | ||
.mp3=audio/mpeg | ||
.wav=audio/wav | ||
.ogg=audio/ogg | ||
.flac=audio/flac | ||
|
||
# Video Files | ||
.mp4=video/mp4 | ||
.avi=video/avi | ||
.mov=video/mov | ||
.mkv=video/mkv | ||
|
||
# Compressed Files | ||
.zip=application/zip | ||
.tar=application/tar | ||
.gz=application/gzip/gz | ||
.rar=application/rar | ||
.7z=application/7z | ||
|
||
# Other Files | ||
.iso=application/iso | ||
.csv=text/csv | ||
.epub=application/epub | ||
.apk=application/apk | ||
.exe=application/exe | ||
.deb=package/deb | ||
.a=library/a | ||
.so=library/so | ||
.dll=library/dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2024 UOS Technology Co., Ltd. | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ANYTHING_ANYTHING_ANALYZER_H_ | ||
#define ANYTHING_ANYTHING_ANALYZER_H_ | ||
|
||
#include <lucene++/LuceneHeaders.h> | ||
|
||
#include "common/anything_fwd.hpp" | ||
|
||
ANYTHING_NAMESPACE_BEGIN | ||
|
||
using namespace Lucene; | ||
|
||
class AnythingAnalyzer : public Analyzer { | ||
public: | ||
TokenStreamPtr tokenStream(const String&, const ReaderPtr& reader) override; | ||
|
||
TokenStreamPtr reusableTokenStream(const String&, const ReaderPtr& reader) override; | ||
}; | ||
|
||
class AnythingAnalyzerSavedStreams : public LuceneObject { | ||
public: | ||
virtual ~AnythingAnalyzerSavedStreams(); | ||
|
||
LUCENE_CLASS(AnythingAnalyzerSavedStreams); | ||
|
||
public: | ||
TokenizerPtr source; | ||
TokenStreamPtr result; | ||
}; | ||
|
||
ANYTHING_NAMESPACE_END | ||
|
||
#endif // ANYTHING_ANYTHING_ANALYZER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (C) 2024 UOS Technology Co., Ltd. | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ANYTHING_ANYTHING_FILTER_H_ | ||
#define ANYTHING_ANYTHING_FILTER_H_ | ||
|
||
#include <lucene++/LuceneHeaders.h> | ||
|
||
#include "common/anything_fwd.hpp" | ||
|
||
ANYTHING_NAMESPACE_BEGIN | ||
|
||
using namespace Lucene; | ||
|
||
class AnythingFilter : public TokenFilter { | ||
public: | ||
AnythingFilter(const TokenStreamPtr& input); | ||
|
||
bool incrementToken() override; | ||
|
||
private: | ||
HashSet<String> stopTable_; | ||
TermAttributePtr termAtt_; | ||
|
||
static const wchar_t* STOP_WORDS[]; | ||
}; | ||
|
||
ANYTHING_NAMESPACE_END | ||
|
||
#endif // ANYTHING_ANYTHING_FILTER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (C) 2024 UOS Technology Co., Ltd. | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ANYTHING_ANYTHING_TOKENIZER_H_ | ||
#define ANYTHING_ANYTHING_TOKENIZER_H_ | ||
|
||
#include <unordered_set> | ||
|
||
#include <lucene++/LuceneHeaders.h> | ||
|
||
#include "common/anything_fwd.hpp" | ||
|
||
ANYTHING_NAMESPACE_BEGIN | ||
|
||
using namespace Lucene; | ||
|
||
class AnythingTokenizer : public Tokenizer { | ||
public: | ||
AnythingTokenizer(const ReaderPtr& input); | ||
|
||
void initialize() override; | ||
bool incrementToken() override; | ||
void end() override; | ||
void reset() override; | ||
void reset(const ReaderPtr& input) override; | ||
|
||
private: | ||
void push(wchar_t c); | ||
bool flush(); | ||
|
||
public: | ||
static bool isSymbol(wchar_t c); | ||
static bool isDot(wchar_t c); | ||
static bool isLastDot(wchar_t c, int32_t offset, std::wstring buf); | ||
bool is_word(wchar_t* buf, int32_t len); | ||
|
||
private: | ||
/// word offset, used to imply which character(in) is parsed | ||
int32_t offset_; | ||
|
||
/// the index used only for ioBuffer | ||
int32_t bufferIndex_; | ||
|
||
/// data length | ||
int32_t dataLen_; | ||
|
||
/// character buffer, store the characters which are used to compose the returned Token | ||
CharArray buffer_; | ||
|
||
/// I/O buffer, used to store the content of the input (one of the members of Tokenizer) | ||
CharArray ioBuffer_; | ||
|
||
TermAttributePtr termAtt_; | ||
OffsetAttributePtr offsetAtt_; | ||
|
||
int32_t length_; | ||
int32_t start_; | ||
|
||
std::unordered_set<std::wstring> words_; | ||
}; | ||
|
||
ANYTHING_NAMESPACE_END | ||
|
||
#endif // ANYTHING_ANYTHING_TOKENIZER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (C) 2024 UOS Technology Co., Ltd. | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef ANYTHING_FILE_RECORD_H_ | ||
#define ANYTHING_FILE_RECORD_H_ | ||
|
||
#include <filesystem> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
#include "common/anything_fwd.hpp" | ||
|
||
ANYTHING_NAMESPACE_BEGIN | ||
|
||
struct file_record { | ||
std::string file_name; | ||
std::string full_path; | ||
std::string file_type; | ||
int64_t creation_time; // milliseconds time since epoch | ||
}; | ||
|
||
class file_helper { | ||
public: | ||
file_helper(); | ||
|
||
file_record make_file_record(const std::filesystem::path& p); | ||
|
||
int64_t get_file_creation_time(const std::filesystem::path& file_path); | ||
int64_t to_milliseconds_since_epoch(std::string date_time); | ||
|
||
private: | ||
bool is_valid_date_format(std::string& date_str); | ||
|
||
private: | ||
std::unordered_map<std::string, std::string> extension_mapper_; | ||
}; | ||
|
||
// namespace file_helper { | ||
|
||
// namespace fs = std::filesystem; | ||
|
||
// inline file_record make_file_record(const fs::path& p) { | ||
// auto handle = ::magic_open(MAGIC_MIME_TYPE); | ||
// ::magic_load(handle, NULL); | ||
// auto file_type = ::magic_file(handle, p.native().c_str()); | ||
// std::string type(file_type ? file_type : "unknown"); | ||
|
||
// ::magic_close(handle); | ||
|
||
// return file_record { | ||
// .file_name = p.filename().string(), | ||
// .full_path = p.string(), | ||
// .file_type = std::move(type) | ||
// }; | ||
// } | ||
|
||
// } // namespace file_helper | ||
|
||
ANYTHING_NAMESPACE_END | ||
|
||
#endif // ANYTHING_FILE_RECORD_H_ |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.