Commit 8629c204 authored by Volker Krause's avatar Volker Krause
Browse files

Complete the new-style extractor API for setting additional extractors

This is needed by the external extractor process.
parent 9b777d1b
......@@ -89,7 +89,7 @@ public:
ExtractorEngine *q = nullptr;
std::vector<Extractor> m_extractors;
std::vector<Extractor> m_additionalExtractors;
std::vector<Extractor> m_additionalExtractorsLegacy;
JsApi::Barcode *m_barcodeApi = nullptr;
JsApi::Context *m_context = nullptr;
JsApi::JsonLd *m_jsonLdApi = nullptr;
......@@ -109,6 +109,7 @@ public:
std::vector<GenericExtractor::Result> m_genericResults;
QJsonArray m_result;
QJSEngine m_engine;
std::vector<const AbstractExtractor*> m_additionalExtractors;
ExtractorDocumentNode m_rootNode;
ExtractorDocumentNode m_contextNode;
ExtractorDocumentNodeFactory m_nodeFactory;
......@@ -204,7 +205,7 @@ void ExtractorEnginePrivate::processNode(ExtractorDocumentNode& node)
node.processor()->reduceNode(node);
node.processor()->preExtract(node, q);
std::vector<const AbstractExtractor*> extractors;
std::vector<const AbstractExtractor*> extractors = m_additionalExtractors;
m_repo.extractorsForNode(node, extractors);
for (const auto &extractor : extractors) {
......@@ -629,7 +630,7 @@ void ExtractorEnginePrivate::extractGeneric()
void ExtractorEnginePrivate::determineExtractors()
{
m_extractors = m_additionalExtractors;
m_extractors = m_additionalExtractorsLegacy;
if (m_pass) {
m_repo.extractorsForPass(m_pass.get(), m_extractors);
......@@ -840,11 +841,16 @@ void ExtractorEngine::setUseSeparateProcess(bool separateProcess)
d->m_externalExtractor = fi.canonicalFilePath();
}
void ExtractorEngine::setAdditionalExtractors(std::vector<Extractor> &&extractors)
void ExtractorEngine::setAdditionalExtractors(std::vector<const AbstractExtractor*> &&extractors)
{
d->m_additionalExtractors = std::move(extractors);
}
void ExtractorEngine::setAdditionalExtractors(std::vector<Extractor> &&extractors)
{
d->m_additionalExtractorsLegacy = std::move(extractors);
}
QString ExtractorEngine::usedCustomExtractor() const
{
return d->m_usedExtractor;
......
......@@ -36,6 +36,7 @@ class QVariant;
namespace KItinerary {
class AbstractExtractor;
class BarcodeDecoder;
class Extractor;
class ExtractorDocumentNode;
......@@ -209,7 +210,8 @@ public:
* Extractors are usually automatically selected, this is therefore most likely not needed to
* be called manually. This mainly exists for the external extractor process.
*/
void setAdditionalExtractors(std::vector<Extractor> &&extractors);
void setAdditionalExtractors(std::vector<const AbstractExtractor*> &&extractors);
[[deprecated("uset setAdditionalExtractors()")]] void setAdditionalExtractors(std::vector<Extractor> &&extractors);
/** Perform the actual extraction, and return the JSON-LD data
* that has been found.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment