Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重构全文搜索 #2439

Merged
merged 13 commits into from
Nov 29, 2024
Merged

Conversation

Johnson-zs
Copy link
Contributor

No description provided.

- Add text index service to dde-file-manager services
- Install text index dbus service file
- Install user json config for text index service

Log: init text index service
- Change target_include_directories visibility to PRIVATE
- Add task manager integration for index operations
- Implement core index service methods
- Add proper signal connections for index operations
- Replace placeholder methods with actual implementations

Log:
- Add proper type registration for IndexTask::Type
- Change task progress type from int to qint64
- Move indexStorePath to global namespace
- Add SPDX license headers
- Improve thread safety with std::atomic_bool
- Add comprehensive logging
- Fix include paths and CMake configuration
- Add fulltext search source files to build

Summary:
This commit focuses on improving the robustness and maintainability of the text
index service, particularly around type safety and thread handling. It also
standardizes the codebase with proper licensing and logging while fixing various
build-related issues.

Log: index for full text
- Extract common directory traversal logic into traverseDirectoryCommon
- Add isSupportedFile helper function for file type checking
- Move directory traversal utilities to separate module
- Improve path validation and directory filtering
- Add visited directory tracking to prevent loops
- Enhance error handling and cleanup in index operations
- Clean up file path handling with QDir::cleanPath

This commit significantly improves the robustness and maintainability of the text
index service by refactoring the directory traversal logic. It introduces better
separation of concerns, adds safeguards against directory loops, and improves
path handling throughout the codebase.

Log:
* replace FinallyUtil with ScopeGuard for RAII resource management
* add ScopeGuard class to handle resource cleanup
* use ScopeGuard for DIR* and Lucene reader/writer cleanup
* ensure exception safety and proper resource release
* remove dependency on dfm-base library

Log: The commit improves code safety and reduces external dependencies while maintaining all existing functionality.
* replace atomic_bool with TaskState class for better state management
* use QAtomicInteger for thread-safe state control
* remove unnecessary mutex and use atomic operations
* fix task stop response delay issue
* optimize code structure and readability

Log: The commit improves task control reliability and responsiveness while maintaining thread safety.
* add QT_DEBUG guard for verbose debug output
* improve debug message format for file operations
* optimize file traversal process
* remove redundant debug output
* improve code readability and maintainability

Log: The commit improves debug output control and code readability while maintaining core functionality.
* fix task state transition logic to avoid infinite loop
* ensure task stops after completion without auto-restart
* add detailed debug logs with [TextIndex] prefix
* ensure service auto-start before DBus connection
* improve error handling and state transition logging

Log: The commit fixes the task state management to properly handle task completion and avoid unnecessary task restarts.
- Add TextIndex DBus interface to search plugin
- Add service activation check in TextIndexController
- Fix task progress reporting and cleanup in TaskManager
- Optimize index update process with better interruption handling

Log: This commit implements the TextIndex DBus interface integration and improves
the service activation mechanism for better reliability.
- Remove local index creation logic from FullTextSearcher
- Add TextIndexClient integration for index operations
- Implement async task handling with proper state management
- Add service status checking and error handling
- Clean up deprecated code and unused functions

This change moves the full-text search index management from local
implementation to the new DBus service, improving reliability and
maintainability of the search functionality.

Log:
- Remove TextIndex DBus service auto-activation config
- Change service policy from OnDemand to Resident mode
- Remove idle timeout and policy path configurations
- Clean up related installation files

This change ensures TextIndex service stays resident instead of
being activated on-demand, which resolves service activation
timing issues.

Log:
- Add index status file to track last successful update time
- Implement status file management for root directory tasks
- Add status clearing on task failure or new root index
- Add debug instructions for service debugging
- Comment out invalid index deletion temporarily

This change adds persistence to track indexing status, which helps
maintain index consistency and enables better recovery from failures.

Log: text index
Copy link

  • 检测到debian目录文件有变更: debian/dde-file-manager-services-plugins.install

- Add missing SPDX license headers to TextIndexClient files
- Update 3rdparty dependency paths in dep5 file
- Move fulltext and fsearch libraries to root 3rdparty directory
- Fix copyright information formatting

This change standardizes license headers and reorganizes 3rdparty
dependency locations for better project structure.

Log: License
Copy link

  • 检测到debian目录文件有变更: debian/dde-file-manager-services-plugins.install

@deepin-ci-robot
Copy link

deepin pr auto review

###PATH:./deepin-file-manager-backend-utest/src/services/textindex/textindexadaptor.cpp
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "textindexadaptor.h"

SERVICETEXTINDEX_USE_NAMESPACE

TextIndexAdaptor::TextIndexAdaptor(TextIndexDBus *qq)
: QDBusAbstractAdaptor(qq), q(qq)
{
Q_UNUSED(q);
}

TextIndexAdaptor::~TextIndexAdaptor()
{
}

bool TextIndexAdaptor::CreateIndexTask(const QString &path)
{
return q->CreateIndexTask(path);
}

bool TextIndexAdaptor::UpdateIndexTask(const QString &path)
{
return q->UpdateIndexTask(path);
}

bool TextIndexAdaptor::StopCurrentTask()
{
return q->StopCurrentTask();
}

bool TextIndexAdaptor::HasRunningTask()
{
return q->HasRunningTask();
}

bool TextIndexAdaptor::IndexDatabaseExists()
{
return q->IndexDatabaseExists();
}

###PATH:./deepin-file-manager-backend-utest/src/services/textindex/textindexadaptor.h
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef TEXTINDEXADAPTOR_H
#define TEXTINDEXADAPTOR_H

#include "service_textindex_global.h"
#include "textindexdbus.h"

SERVICETEXTINDEX_BEGIN_NAMESPACE
class TextIndexAdaptor : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.deepin.Filemanager.TextIndex")
public:
explicit TextIndexAdaptor(TextIndexDBus *qq);
~TextIndexAdaptor();

public Q_SLOTS:
bool CreateIndexTask(const QString &path);
bool UpdateIndexTask(const QString &path);
bool StopCurrentTask();
bool HasRunningTask();
bool IndexDatabaseExists();

private:
TextIndexDBus *q;
};

SERVICETEXTINDEX_END_NAMESPACE

#endif // TEXTINDEXADAPTOR_H

"/run", // 运行时文件

// 特殊目录
"/root", // root用户目录
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

跳过root目录,管理员打开的文管就搜索不到了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,下次恢复

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs, max-lvs

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Johnson-zs Johnson-zs merged commit 7a60b1b into linuxdeepin:develop/snipe-25 Nov 29, 2024
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants