Changeset View
Changeset View
Standalone View
Standalone View
src/file/extractor/result.cpp
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 116 | { | |||
---|---|---|---|---|---|
119 | m_doc.addTerm(t.toUtf8()); | 119 | m_doc.addTerm(t.toUtf8()); | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | void Result::finish() | 122 | void Result::finish() | ||
123 | { | 123 | { | ||
124 | QJsonObject jo = QJsonObject::fromVariantMap(m_map); | 124 | QJsonObject jo = QJsonObject::fromVariantMap(m_map); | ||
125 | QJsonDocument jdoc; | 125 | QJsonDocument jdoc; | ||
126 | jdoc.setObject(jo); | 126 | jdoc.setObject(jo); | ||
127 | m_doc.setData(jdoc.toJson()); | 127 | m_doc.setData(jdoc.toJson(QJsonDocument::JsonFormat::Compact)); | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | void Result::setDocument(const Baloo::Document& doc) | 130 | void Result::setDocument(const Baloo::Document& doc) | ||
131 | { | 131 | { | ||
132 | m_doc = doc; | 132 | m_doc = doc; | ||
133 | // All document metadata are indexed from position 1000 | 133 | // All document metadata are indexed from position 1000 | ||
134 | m_termGen.setDocument(&m_doc); | 134 | m_termGen.setDocument(&m_doc); | ||
135 | m_termGen.setPosition(1000); | 135 | m_termGen.setPosition(1000); | ||
136 | 136 | | |||
137 | // All document plain text starts from 10000. This is done to avoid | 137 | // All document plain text starts from 10000. This is done to avoid | ||
138 | // clashes with the term positions | 138 | // clashes with the term positions | ||
139 | m_termGenForText.setDocument(&m_doc); | 139 | m_termGenForText.setDocument(&m_doc); | ||
140 | m_termGenForText.setPosition(10000); | 140 | m_termGenForText.setPosition(10000); | ||
141 | } | 141 | } |