zoom: warn if %query is not defined and Explain is used
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 10 Feb 2012 14:35:03 +0000 (15:35 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 10 Feb 2012 14:35:03 +0000 (15:35 +0100)
src/torus.cpp

index bd0a63b..e286adf 100644 (file)
@@ -42,6 +42,15 @@ xmlDoc *mp::get_searchable(mp::Package &package,
     found = url_template.find("%query");
     if (found != std::string::npos)
         url_template.replace(found, 6, mp::util::uri_encode(query));
+    else
+    {
+        if (db.length() == 0)
+        {
+            package.log("zoom", YLOG_WARN,
+                        "%query not defined in <torus url=\"..\"");
+            return 0;
+        }
+    }
 
     found = url_template.find("%db");
     if (found != std::string::npos)