diff --git a/.htaccess b/.htaccess
index 526c60b..b612e5d 100644
--- a/.htaccess
+++ b/.htaccess
@@ -121,7 +121,7 @@ DirectoryIndex index.php index.html index.htm
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !=/favicon.ico
-  RewriteRule ^ index.php [L]
+  RewriteRule ^ /~d8test/index.php [L]
 
   # If this is a production site you may want to forbid access to PHP files in
   # subfolders for security reasons. If you need to directly execute PHP files
diff --git a/core/modules/search/lib/Drupal/search/SearchQuery.php b/core/modules/search/lib/Drupal/search/SearchQuery.php
index b9b41c6..3f5f68d 100644
--- a/core/modules/search/lib/Drupal/search/SearchQuery.php
+++ b/core/modules/search/lib/Drupal/search/SearchQuery.php
@@ -249,6 +249,11 @@ protected function parseSearchExpression() {
     foreach ($this->keys['positive'] as $key) {
       // Group of ORed terms.
       if (is_array($key) && count($key)) {
+        // If we had already found one OR, this is another one AND-ed with the
+        // first, meaning it is not a simple query.
+        if ($simple_or) {
+          $this->simple = FALSE;
+        }
         $simple_or = TRUE;
         $any = FALSE;
         $queryor = db_or();
@@ -345,8 +350,15 @@ public function executeFirstPass() {
     $this
       ->condition('i.type', $this->type)
       ->groupBy('i.type')
-      ->groupBy('i.sid')
-      ->having('COUNT(*) >= :matches', array(':matches' => $this->matches));
+      ->groupBy('i.sid');
+
+    // If the query is simple, we should have calculated the number of
+    // matching words we need to find, so impose that criterion. For non-
+    // simple queries, this condition could lead to incorrectly deciding not
+    // to continue with the full query. See issue #1842226.
+    if ($this->simple) {
+      $this->having('COUNT(*) >= :matches', array(':matches' => $this->matches));
+    }
 
     // Clone the query object to do the firstPass query;
     $first = clone $this->query;
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php
index 27b427d..d87e99f 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php
@@ -94,15 +94,13 @@ function getText2($n) {
    * Run predefine queries looking for indexed terms.
    */
   function _testQueries() {
-    /*
-      Note: OR queries that include short words in OR groups are only accepted
-      if the ORed terms are ANDed with at least one long word in the rest of the query.
-
-      e.g. enim dolore OR ut = enim (dolore OR ut) = (enim dolor) OR (enim ut) -> good
-      e.g. dolore OR ut = (dolore) OR (ut) -> bad
-
-      This is a design limitation to avoid full table scans.
-    */
+    // Note: OR queries that include short words in OR groups are only accepted
+    // if the ORed terms are ANDed with at least one long word in the rest of
+    // the query. Examples:
+    //   enim dolore OR ut = enim (dolore OR ut) = (enim dolor) OR (enim ut)
+    // is good, and
+    //   dolore OR ut = (dolore) OR (ut)
+    // is bad. This is a design limitation to avoid full table scans.
     $queries = array(
       // Simple AND queries.
       'ipsum' => array(1),
@@ -115,7 +113,7 @@ function _testQueries() {
       'ut minim' => array(5),
       'xx minim' => array(),
       'enim veniam am minim ut' => array(5),
-      // Simple OR queries.
+      // Simple OR and AND/OR queries.
       'dolore OR ipsum' => array(1, 2, 7),
       'dolore OR xxxxx' => array(2, 7),
       'dolore OR ipsum OR enim' => array(1, 2, 4, 5, 6, 7),
@@ -125,6 +123,14 @@ function _testQueries() {
       'minim dolore OR ipsum OR enim' => array(5, 6, 7),
       'dolore xx OR yy' => array(),
       'xxxxx dolore OR ipsum' => array(),
+      // Sequence of OR queries to test issue #1842226
+      'minim' => array(5, 6, 7),
+      'minim OR xxxx' => array(5, 6, 7),
+      'minim OR xxxx OR minum' => array(5, 6, 7),
+      'minim OR xxxx minum' => array(5, 6, 7),
+      'minim OR xxxx minum OR yyyy' => array(5, 6, 7),
+      'minim OR xxxx minum OR cillum' => array(5, 6, 7),
+      'minim OR xxxx minum OR xxxx' => array(5, 6, 7),
       // Negative queries.
       'dolore -sit' => array(7),
       'dolore -eu' => array(2),
