* If type filter is in quotes, throw an error.
* If there are generics, don't allow to have quotes.
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 55d957d..03518cd 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -216,11 +216,13 @@
         }
         function isPathStart(query) {
             var pos = query.pos;
-            return pos + 1 < query.length && query.userQuery[pos] === ':' && query.userQuery[pos + 1] === ':';
+            return pos + 1 < query.length && query.userQuery[pos] === ':' &&
+                query.userQuery[pos + 1] === ':';
         }
         function isReturnArrow(query) {
             var pos = query.pos;
-            return pos + 1 < query.length && query.userQuery[pos] === '-' && query.userQuery[pos + 1] === '>';
+            return pos + 1 < query.length && query.userQuery[pos] === '-' &&
+                query.userQuery[pos + 1] === '>';
         }
         function removeEmptyStringsFromArray(x) {
             for (var i = 0, len = x.length; i < len; ++i) {
@@ -235,6 +237,9 @@
             if (name === '*' || (name.length === 0 && generics.length === 0)) {
                 return;
             }
+            if (query.literalSearch && query.totalElems > 0) {
+                throw new Error("You cannot have more than one element if you use quotes");
+            }
             var paths = name.split("::");
             removeEmptyStringsFromArray(paths);
             // In case we only have something like `<p>`, there is no name but it remains valid.
@@ -320,6 +325,9 @@
                 } else if (c === ":" && query.typeFilter === null && !isPathStart(query) &&
                            query.elems.length === 1)
                 {
+                    if (query.literalSearch) {
+                        throw new Error("You cannot use quotes on type filter");
+                    }
                     // The type filter doesn't count as an element since it's a modifier.
                     query.typeFilter = query.elems.pop().name;
                     query.pos += 1;
@@ -400,7 +408,7 @@
         if (!query.literalSearch) {
             // If there is more than one element in the query, we switch to literalSearch in any
             // case.
-            query.literalSearch = query.foundElems > 1;
+            query.literalSearch = query.totalElems > 1;
         }
         if (query.elemName !== null) {
             query.foundElems += 1;
diff --git a/src/test/rustdoc-js-std/parser-errors.js b/src/test/rustdoc-js-std/parser-errors.js
index b789fd0..c5d1061 100644
--- a/src/test/rustdoc-js-std/parser-errors.js
+++ b/src/test/rustdoc-js-std/parser-errors.js
@@ -1,4 +1,4 @@
-const QUERY = ['<"P">', '"P" "P"', 'P "P"'];
+const QUERY = ['<"P">', '"P" "P"', 'P "P"', '"p" p', '"const": p'];
 
 const PARSED = [
     {
@@ -40,4 +40,30 @@
         userQuery: "p \"p\"",
         error: "Cannot use literal search when there is more than one element",
     },
+    {
+        args: [],
+        elemName: null,
+        elems: [],
+        foundElems: 0,
+        id: "\"p\" p",
+        nameSplit: null,
+        original: "\"p\" p",
+        returned: [],
+        typeFilter: null,
+        userQuery: "\"p\" p",
+        error: "You cannot have more than one element if you use quotes",
+    },
+    {
+        args: [],
+        elemName: null,
+        elems: [],
+        foundElems: 0,
+        id: "\"const\": p",
+        nameSplit: null,
+        original: "\"const\": p",
+        returned: [],
+        typeFilter: null,
+        userQuery: "\"const\": p",
+        error: "You cannot use quotes on type filter",
+    },
 ];
diff --git a/src/test/rustdoc-js-std/parser-literal.js b/src/test/rustdoc-js-std/parser-literal.js
index 1a70baf..f1713fb 100644
--- a/src/test/rustdoc-js-std/parser-literal.js
+++ b/src/test/rustdoc-js-std/parser-literal.js
@@ -1,4 +1,4 @@
-const QUERY = ['"R"<P>'];
+const QUERY = ['R<P>'];
 
 const PARSED = [
     {
@@ -20,12 +20,12 @@
             ],
         }],
         foundElems: 1,
-        id: "\"R\"<P>",
+        id: "R<P>",
         nameSplit: null,
-        original: "\"R\"<P>",
+        original: "R<P>",
         returned: [],
         typeFilter: -1,
-        userQuery: "\"r\"<p>",
+        userQuery: "r<p>",
         error: null,
     }
 ];
diff --git a/src/test/rustdoc-js-std/parser-quote.js b/src/test/rustdoc-js-std/parser-quote.js
index aa1b8d3..1c59a3d 100644
--- a/src/test/rustdoc-js-std/parser-quote.js
+++ b/src/test/rustdoc-js-std/parser-quote.js
@@ -1,4 +1,4 @@
-const QUERY = ['-> "p"', '"const": "p"', '("p")', '"p"<p>'];
+const QUERY = ['-> "p"', '("p")'];
 
 const PARSED = [
     {
@@ -20,27 +20,6 @@
         userQuery: "-> \"p\"",
         error: null,
     },
-    // This one checks that if quotes are used on the type filter, they're
-    // simply ignored.
-    {
-        args: [],
-        elemName: null,
-        elems: [{
-            name: "p",
-            fullPath: ["p"],
-            pathWithoutLast: [],
-            pathLast: "p",
-            generics: [],
-        }],
-        foundElems: 1,
-        id: "\"const\": \"p\"",
-        nameSplit: null,
-        original: "\"const\": \"p\"",
-        returned: [],
-        typeFilter: 17,
-        userQuery: "\"const\": \"p\"",
-        error: null,
-    },
     {
         args: [{
             name: "p",
@@ -60,30 +39,4 @@
         userQuery: "(\"p\")",
         error: null,
     },
-    // This test checks that a literal item can still have generics.
-    {
-        args: [],
-        elemName: null,
-        elems: [{
-            name: "p",
-            fullPath: ["p"],
-            pathWithoutLast: [],
-            pathLast: "p",
-            generics: [{
-                name: "p",
-                fullPath: ["p"],
-                pathWithoutLast: [],
-                pathLast: "p",
-                generics: [],
-            }],
-        }],
-        foundElems: 1,
-        id: "\"p\"<p>",
-        nameSplit: null,
-        original: "\"p\"<p>",
-        returned: [],
-        typeFilter: -1,
-        userQuery: "\"p\"<p>",
-        error: null,
-    },
 ];
diff --git a/src/test/rustdoc-js/generics.js b/src/test/rustdoc-js/generics.js
index babfbf9..4aa6b35 100644
--- a/src/test/rustdoc-js/generics.js
+++ b/src/test/rustdoc-js/generics.js
@@ -1,10 +1,10 @@
 // exact-check
 
 const QUERY = [
-    '"R"<P>',
+    'R<P>',
     '"P"',
     'P',
-    '"ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
+    'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
     'TraitCat',
     'TraitDog',
     'Result<String>',