feat(index-monitor)增加查询索引是否正在执行增量更新的接口
This commit is contained in:
parent
166218115a
commit
7434d31d7b
|
@ -88,6 +88,9 @@ IndexMonitor::IndexMonitor(QObject *parent) : QObject(parent), d(new IndexMonito
|
||||||
connect(d->m_monitorReplica, &MonitorReplica::basicIndexDone, this, &IndexMonitor::basicIndexDone);
|
connect(d->m_monitorReplica, &MonitorReplica::basicIndexDone, this, &IndexMonitor::basicIndexDone);
|
||||||
connect(d->m_monitorReplica, &MonitorReplica::contentIndexDone, this, &IndexMonitor::contentIndexDone);
|
connect(d->m_monitorReplica, &MonitorReplica::contentIndexDone, this, &IndexMonitor::contentIndexDone);
|
||||||
connect(d->m_monitorReplica, &MonitorReplica::ocrContentIndexDone, this, &IndexMonitor::ocrContentIndexDone);
|
connect(d->m_monitorReplica, &MonitorReplica::ocrContentIndexDone, this, &IndexMonitor::ocrContentIndexDone);
|
||||||
|
connect(d->m_monitorReplica, &MonitorReplica::basicIndexUpdatingChanged, this, &IndexMonitor::basicIndexUpdatingChanged);
|
||||||
|
connect(d->m_monitorReplica, &MonitorReplica::contentIndexUpdatingChanged, this, &IndexMonitor::contentIndexUpdatingChanged);
|
||||||
|
connect(d->m_monitorReplica, &MonitorReplica::ocrContentIndexUpdatingChanged, this, &IndexMonitor::ocrContentIndexUpdatingChanged);
|
||||||
|
|
||||||
connect(d->m_monitorReplica, &QRemoteObjectReplica::initialized, this, &IndexMonitor::serviceReady);
|
connect(d->m_monitorReplica, &QRemoteObjectReplica::initialized, this, &IndexMonitor::serviceReady);
|
||||||
connect(d->m_monitorReplica, &QRemoteObjectReplica::stateChanged, this, [&](QRemoteObjectReplica::State state, QRemoteObjectReplica::State oldState){
|
connect(d->m_monitorReplica, &QRemoteObjectReplica::stateChanged, this, [&](QRemoteObjectReplica::State state, QRemoteObjectReplica::State oldState){
|
||||||
|
@ -159,4 +162,19 @@ uint IndexMonitor::ocrContentIndexDocNum() const
|
||||||
{
|
{
|
||||||
return d->m_monitorReplica->ocrContentIndexDocNum();
|
return d->m_monitorReplica->ocrContentIndexDocNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IndexMonitor::basicIndexUpdating() const
|
||||||
|
{
|
||||||
|
return d->m_monitorReplica->basicIndexUpdating();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IndexMonitor::contentIndexUpdating() const
|
||||||
|
{
|
||||||
|
return d->m_monitorReplica->contentIndexUpdating();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IndexMonitor::ocrContentIndexUpdating() const
|
||||||
|
{
|
||||||
|
return d->m_monitorReplica->ocrContentIndexUpdating();
|
||||||
|
}
|
||||||
} // UkuiSearch
|
} // UkuiSearch
|
|
@ -101,6 +101,21 @@ public:
|
||||||
* @return ocr内容索引完成的总文档数
|
* @return ocr内容索引完成的总文档数
|
||||||
*/
|
*/
|
||||||
uint ocrContentIndexDocNum() const;
|
uint ocrContentIndexDocNum() const;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return 基础索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool basicIndexUpdating() const;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return 文本内容索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool contentIndexUpdating() const;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return ocr索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool ocrContentIndexUpdating() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void currentIndexPathsChanged(QStringList currentIndexPaths);
|
void currentIndexPathsChanged(QStringList currentIndexPaths);
|
||||||
|
@ -120,6 +135,9 @@ Q_SIGNALS:
|
||||||
void basicIndexDone(bool success);
|
void basicIndexDone(bool success);
|
||||||
void contentIndexDone(bool success);
|
void contentIndexDone(bool success);
|
||||||
void ocrContentIndexDone(bool success);
|
void ocrContentIndexDone(bool success);
|
||||||
|
void basicIndexUpdatingChanged(bool basicIndexUpdating);
|
||||||
|
void contentIndexUpdatingChanged(bool contentIndexUpdating);
|
||||||
|
void ocrContentIndexUpdatingChanged(bool ocrContentIndexUpdating);
|
||||||
|
|
||||||
void serviceReady();
|
void serviceReady();
|
||||||
void serviceOffline();
|
void serviceOffline();
|
||||||
|
|
|
@ -12,6 +12,9 @@ class Monitor
|
||||||
PROP(uint basicIndexDocNum READONLY);
|
PROP(uint basicIndexDocNum READONLY);
|
||||||
PROP(uint contentIndexDocNum READONLY);
|
PROP(uint contentIndexDocNum READONLY);
|
||||||
PROP(uint ocrContentIndexDocNum READONLY);
|
PROP(uint ocrContentIndexDocNum READONLY);
|
||||||
|
PROP(bool basicIndexUpdating READONLY);
|
||||||
|
PROP(bool contentIndexUpdating READONLY);
|
||||||
|
PROP(bool ocrContentIndexUpdating READONLY);
|
||||||
SIGNAL(basicIndexStart());
|
SIGNAL(basicIndexStart());
|
||||||
SIGNAL(contentIndexStart());
|
SIGNAL(contentIndexStart());
|
||||||
SIGNAL(ocrContentIndexStart());
|
SIGNAL(ocrContentIndexStart());
|
||||||
|
|
|
@ -37,6 +37,9 @@ IndexMonitorTest::IndexMonitorTest(QObject *parent) : QObject(parent)
|
||||||
qDebug() << "==basicIndexDocNum==" << m_monitor->basicIndexDocNum();
|
qDebug() << "==basicIndexDocNum==" << m_monitor->basicIndexDocNum();
|
||||||
qDebug() << "==contentIndexDocNum==" << m_monitor->contentIndexDocNum();
|
qDebug() << "==contentIndexDocNum==" << m_monitor->contentIndexDocNum();
|
||||||
qDebug() << "==ocrContentIndexDocNum==" << m_monitor->ocrContentIndexDocNum();
|
qDebug() << "==ocrContentIndexDocNum==" << m_monitor->ocrContentIndexDocNum();
|
||||||
|
qDebug() << "==basicIndexUpdating==" << m_monitor->basicIndexUpdating();
|
||||||
|
qDebug() << "==contentIndexUpdating==" << m_monitor->contentIndexUpdating();
|
||||||
|
qDebug() << "==ocrContentIndexUpdating==" << m_monitor->ocrContentIndexUpdating();
|
||||||
});
|
});
|
||||||
connect(m_monitor, &UkuiSearch::IndexMonitor::serviceOffline, this, [&](){
|
connect(m_monitor, &UkuiSearch::IndexMonitor::serviceOffline, this, [&](){
|
||||||
qDebug() << "==serviceReady==";
|
qDebug() << "==serviceReady==";
|
||||||
|
@ -92,6 +95,15 @@ IndexMonitorTest::IndexMonitorTest(QObject *parent) : QObject(parent)
|
||||||
connect(m_monitor, &UkuiSearch::IndexMonitor::ocrContentIndexDone, this, [&](bool success){
|
connect(m_monitor, &UkuiSearch::IndexMonitor::ocrContentIndexDone, this, [&](bool success){
|
||||||
qDebug() << "==ocrContentIndexDone==" << success;
|
qDebug() << "==ocrContentIndexDone==" << success;
|
||||||
});
|
});
|
||||||
|
connect(m_monitor, &UkuiSearch::IndexMonitor::basicIndexUpdatingChanged, this, [&](bool updating){
|
||||||
|
qDebug() << "==basicIndexUpdatingChanged==" << updating;
|
||||||
|
});
|
||||||
|
connect(m_monitor, &UkuiSearch::IndexMonitor::contentIndexUpdatingChanged, this, [&](bool updating){
|
||||||
|
qDebug() << "==contentIndexUpdatingChanged==" << updating;
|
||||||
|
});
|
||||||
|
connect(m_monitor, &UkuiSearch::IndexMonitor::ocrContentIndexUpdatingChanged, this, [&](bool updating){
|
||||||
|
qDebug() << "==ocrContentIndexUpdatingChanged==" << updating;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexMonitorTest::~IndexMonitorTest()
|
IndexMonitorTest::~IndexMonitorTest()
|
||||||
|
|
|
@ -29,12 +29,36 @@ Monitor::Monitor(IndexScheduler *scheduler, QObject *parent) : MonitorSource(par
|
||||||
{
|
{
|
||||||
connect(scheduler, &IndexScheduler::stateChange, this, &Monitor::onIndexStateChanged);
|
connect(scheduler, &IndexScheduler::stateChange, this, &Monitor::onIndexStateChanged);
|
||||||
connect(scheduler, &IndexScheduler::process, this, &Monitor::processUpdate);
|
connect(scheduler, &IndexScheduler::process, this, &Monitor::processUpdate);
|
||||||
connect(scheduler, &IndexScheduler::basicIndexDone, this, &Monitor::basicIndexDone);
|
connect(scheduler, &IndexScheduler::basicIndexDone, this, [&](bool success){
|
||||||
connect(scheduler, &IndexScheduler::contentIndexDone, this, &Monitor::contentIndexDone);
|
Q_EMIT basicIndexDone(success);
|
||||||
connect(scheduler, &IndexScheduler::ocrContentIndexDone, this, &Monitor::ocrContentIndexDone);
|
m_basicIndexUpdating = false;
|
||||||
connect(scheduler, &IndexScheduler::basicIndexStart, this, &Monitor::basicIndexStart);
|
Q_EMIT basicIndexUpdatingChanged(m_basicIndexUpdating);
|
||||||
connect(scheduler, &IndexScheduler::contentIndexStart, this, &Monitor::contentIndexStart);
|
});
|
||||||
connect(scheduler, &IndexScheduler::ocrContentIndexStart, this, &Monitor::ocrContentIndexStart);
|
connect(scheduler, &IndexScheduler::contentIndexDone, this, [&](bool success){
|
||||||
|
Q_EMIT contentIndexDone(success);
|
||||||
|
m_contentIndexUpdating = false;
|
||||||
|
Q_EMIT contentIndexUpdatingChanged(m_contentIndexUpdating);
|
||||||
|
});
|
||||||
|
connect(scheduler, &IndexScheduler::ocrContentIndexDone, this, [&](bool success){
|
||||||
|
Q_EMIT ocrContentIndexDone(success);
|
||||||
|
m_ocrContentIndexUpdating = false;
|
||||||
|
Q_EMIT ocrContentIndexUpdatingChanged(m_ocrContentIndexUpdating);
|
||||||
|
});
|
||||||
|
connect(scheduler, &IndexScheduler::basicIndexStart, this, [&](){
|
||||||
|
Q_EMIT basicIndexStart();
|
||||||
|
m_basicIndexUpdating = true;
|
||||||
|
Q_EMIT basicIndexUpdatingChanged(m_basicIndexUpdating);
|
||||||
|
});
|
||||||
|
connect(scheduler, &IndexScheduler::contentIndexStart, this, [&](){
|
||||||
|
Q_EMIT contentIndexStart();
|
||||||
|
m_contentIndexUpdating = true;
|
||||||
|
Q_EMIT contentIndexUpdatingChanged(m_contentIndexUpdating);
|
||||||
|
});
|
||||||
|
connect(scheduler, &IndexScheduler::ocrContentIndexStart, this, [&](){
|
||||||
|
Q_EMIT ocrContentIndexStart();
|
||||||
|
m_ocrContentIndexUpdating = true;
|
||||||
|
Q_EMIT ocrContentIndexUpdatingChanged(m_ocrContentIndexUpdating);
|
||||||
|
});
|
||||||
connect(FileIndexerConfig::getInstance(), &FileIndexerConfig::appendIndexDir, this, [&](){
|
connect(FileIndexerConfig::getInstance(), &FileIndexerConfig::appendIndexDir, this, [&](){
|
||||||
m_currentIndexPaths = FileIndexerConfig::getInstance()->currentIndexableDir();
|
m_currentIndexPaths = FileIndexerConfig::getInstance()->currentIndexableDir();
|
||||||
Q_EMIT currentIndexPathsChanged(m_currentIndexPaths);
|
Q_EMIT currentIndexPathsChanged(m_currentIndexPaths);
|
||||||
|
@ -170,3 +194,18 @@ void Monitor::processUpdate(IndexType type, uint all, uint finished)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Monitor::basicIndexUpdating() const
|
||||||
|
{
|
||||||
|
return m_basicIndexUpdating;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Monitor::contentIndexUpdating() const
|
||||||
|
{
|
||||||
|
return m_contentIndexUpdating;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Monitor::ocrContentIndexUpdating() const
|
||||||
|
{
|
||||||
|
return m_ocrContentIndexUpdating;
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ class Monitor : public MonitorSource
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Monitor(IndexScheduler* scheduler, QObject *parent = nullptr);
|
explicit Monitor(IndexScheduler* scheduler, QObject *parent = nullptr);
|
||||||
/**
|
/**
|
||||||
* @brief currentIndexPaths
|
* @brief currentIndexPaths
|
||||||
* @return 当前索引的所有目录
|
* @return 当前索引的所有目录
|
||||||
|
@ -90,6 +90,21 @@ public:
|
||||||
* @return ocr容索引完成的总文档数
|
* @return ocr容索引完成的总文档数
|
||||||
*/
|
*/
|
||||||
uint ocrContentIndexDocNum() const override;
|
uint ocrContentIndexDocNum() const override;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return 基础索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool basicIndexUpdating() const override;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return 文本内容索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool contentIndexUpdating() const override;
|
||||||
|
/**
|
||||||
|
* basicIndexUpdating
|
||||||
|
* @return ocr索引是否正在执行增量更新
|
||||||
|
*/
|
||||||
|
virtual bool ocrContentIndexUpdating() const override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onIndexStateChanged(IndexScheduler::IndexerState);
|
void onIndexStateChanged(IndexScheduler::IndexerState);
|
||||||
|
@ -110,6 +125,9 @@ private:
|
||||||
uint m_basicIndexDocNum = 0;
|
uint m_basicIndexDocNum = 0;
|
||||||
uint m_contentIndexDocNum = 0;
|
uint m_contentIndexDocNum = 0;
|
||||||
uint m_ocrContentIndexDocNum = 0;
|
uint m_ocrContentIndexDocNum = 0;
|
||||||
|
bool m_basicIndexUpdating = false;
|
||||||
|
bool m_contentIndexUpdating = false;
|
||||||
|
bool m_ocrContentIndexUpdating = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // MONITOR_H
|
#endif // MONITOR_H
|
||||||
|
|
Loading…
Reference in New Issue