summaryrefslogtreecommitdiff
path: root/sw/source/core/model/SearchResultLocator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/model/SearchResultLocator.cxx')
-rw-r--r--sw/source/core/model/SearchResultLocator.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/sw/source/core/model/SearchResultLocator.cxx b/sw/source/core/model/SearchResultLocator.cxx
index 089859683cb4..b4f10a16ca72 100644
--- a/sw/source/core/model/SearchResultLocator.cxx
+++ b/sw/source/core/model/SearchResultLocator.cxx
@@ -51,7 +51,7 @@ void SearchResultLocator::findOne(LocationResult& rResult, SearchIndexData const
rArea.Top() + rArea.Height());
}
}
- else if (rSearchIndexData.meType == NodeType::SdrObject)
+ else if (rSearchIndexData.meType == NodeType::CommonNode)
{
IDocumentDrawModelAccess& rDrawModelAccess = mpDocument->getIDocumentDrawModelAccess();
auto* pModel = rDrawModelAccess.GetDrawModel();
@@ -109,12 +109,18 @@ bool SearchResultLocator::tryParseJSON(const char* pPayload,
{
auto const& rEach = rEachNode.second;
- sal_Int32 nType = rEach.get<sal_Int32>("type", 0);
+ std::string sType = rEach.get<std::string>("node_type", "");
+ auto eNodeType = sw::search::NodeType::Undefined;
+ if (sType == "writer")
+ eNodeType = sw::search::NodeType::WriterNode;
+ else if (sType == "common")
+ eNodeType = sw::search::NodeType::CommonNode;
+
sal_Int32 nIndex = rEach.get<sal_Int32>("index", -1);
// Don't add search data elements that don't have valid data
- if (nType > 0 && nIndex >= 0)
- rDataVector.emplace_back(sw::search::NodeType(nType), nIndex);
+ if (eNodeType != sw::search::NodeType::Undefined && nIndex >= 0)
+ rDataVector.emplace_back(eNodeType, nIndex);
}
return true;
@@ -145,14 +151,20 @@ bool SearchResultLocator::tryParseXML(const char* pPayload,
{
if (aWalker.name() == "paragraph")
{
- OString sType = aWalker.attribute("type");
+ OString sType = aWalker.attribute("node_type");
OString sIndex = aWalker.attribute("index");
if (!sType.isEmpty() && !sIndex.isEmpty())
{
sw::search::SearchIndexData aData;
aData.mnNodeIndex = sIndex.toInt32();
- aData.meType = sw::search::NodeType(sType.toInt32());
+ auto eNodeType = sw::search::NodeType::Undefined;
+ if (sType == "writer")
+ eNodeType = sw::search::NodeType::WriterNode;
+ else if (sType == "common")
+ eNodeType = sw::search::NodeType::CommonNode;
+
+ aData.meType = eNodeType;
rDataVector.push_back(aData);
}