summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchreader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opensearch/opensearchreader.cpp')
-rw-r--r--src/opensearch/opensearchreader.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/opensearch/opensearchreader.cpp b/src/opensearch/opensearchreader.cpp
index 7da4113f..ebca7877 100644
--- a/src/opensearch/opensearchreader.cpp
+++ b/src/opensearch/opensearchreader.cpp
@@ -145,16 +145,17 @@ OpenSearchEngine *OpenSearchReader::read()
}
else
{
- engine->setSuggestionsUrlTemplate(url);
- engine->setSuggestionsParameters(parameters);
-
- if (type == QL1S("application/x-suggestions+xml"))
+ if (engine->suggestionsUrlTemplate().isEmpty() && type == QL1S("application/x-suggestions+json")) //note: xml is prefered
{
- engine->setSuggestionParser(new XMLParser());
+ engine->setSuggestionsUrlTemplate(url);
+ engine->setSuggestionsParameters(parameters);
+ engine->setSuggestionParser(new JSONParser());
}
- else if (type == QL1S("application/x-suggestions+json"))
+ else if (type == QL1S("application/x-suggestions+xml"))
{
- engine->setSuggestionParser(new JSONParser());
+ engine->setSuggestionsUrlTemplate(url);
+ engine->setSuggestionsParameters(parameters);
+ engine->setSuggestionParser(new XMLParser());
}
}