diff --git a/src/Lunr/Gravity/Database/DMLQueryBuilderInterface.php b/src/Lunr/Gravity/Database/DMLQueryBuilderInterface.php
index ca041927ce2ba5ec86cf947c033ce8829faa5d6b..e1045b328a17614419e097f996455a2062848ac0 100644
--- a/src/Lunr/Gravity/Database/DMLQueryBuilderInterface.php
+++ b/src/Lunr/Gravity/Database/DMLQueryBuilderInterface.php
@@ -443,11 +443,11 @@ interface DMLQueryBuilderInterface
      * Define a UNION or UNION ALL clause of the SQL statement.
      *
      * @param string $sql_query SQL query reference
-     * @param bool   $all       True for ALL or False for empty (default).
+     * @param string $type      Type of UNION operation to perform.
      *
      * @return DMLQueryBuilderInterface $self Self reference
      */
-    public function union($sql_query, $all = FALSE);
+    public function union($sql_query, $type);
 
     /**
      * Define the lock mode for a transaction.
diff --git a/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php b/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
index 621fa1a63924c86be87d70d1877aad9107e93fec..d35eddd3dac90e5768925a1362ac18be064dc673 100644
--- a/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
@@ -808,16 +808,27 @@ abstract class DatabaseDMLQueryBuilder implements DMLQueryBuilderInterface
      * Define a compound clause for the SQL statement.
      *
      * @param string $sql_query Left expression
-     * @param string $base      Whether to construct UNION, EXCEPT or INTERSECT
+     * @param string $operation Whether to construct UNION, EXCEPT or INTERSECT
      *
      * @return void
      */
-    protected function sql_compound($sql_query, $base)
+    protected function sql_compound($sql_query, $operation)
     {
         if ($this->compound != '')
         {
             $this->compound .= ' ';
         }
+        // Getting the explicit operation sufix if any.
+        $sufix = substr($operation, strpos($operation, " "));
+        // Pass the operation as having the explicit type or the default.
+        if($sufix == ' ALL' || $sufix == ' DISTINCT' || empty($sufix))
+        {
+            $base = trim($operation);
+        }
+        else{
+            // Making sure operation defaults if type passed isn't allowed.
+            ($sufix == $operation) ? $base = trim($operation) : $base = str_replace($sufix,"",$operation);
+        }
 
         $this->compound .= $base . ' ' . $sql_query;
     }
diff --git a/src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php b/src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php
index 4d2faca639ee137b3cf9b46213c2b5024c937a81..c9f1f1ce41f1bcb8e783a6d3da758ec9e42d4520 100644
--- a/src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php
@@ -782,13 +782,13 @@ class MySQLSimpleDMLQueryBuilder implements DMLQueryBuilderInterface
      * Define a UNION or UNION ALL clause of the SQL statement.
      *
      * @param string $sql_query SQL query reference
-     * @param bool   $all       True for ALL or False for empty (default).
+     * @param string $type      Type of UNION operation to perform.
      *
      * @return MySQLSimpleDMLQueryBuilder $self Self reference
      */
-    public function union($sql_query, $all = FALSE)
+    public function union($sql_query, $type = NULL)
     {
-        $this->builder->union($this->escaper->query_value($sql_query), $all);
+        $this->builder->union($this->escaper->query_value($sql_query), $type);
         return $this;
     }
 
diff --git a/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php b/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php
index 7cf20eda8677702090279357ddc98389e3cf23dc..7908375924ea31c1263382e917b1cf701669c034 100644
--- a/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php
+++ b/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php
@@ -211,6 +211,26 @@ class MySQLSimpleDMLQueryBuilderSelectTest extends MySQLSimpleDMLQueryBuilderTes
         $this->class->union('query');
     }
 
+    /**
+     * Test union() distinct.
+     *
+     * @covers Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder::union
+     */
+    public function testUnionDistinct(): void
+    {
+        $this->escaper->expects($this->once())
+                      ->method('query_value')
+                      ->with($this->equalTo('query'))
+                      ->will($this->returnValue('(query)'));
+
+        $this->builder->expects($this->once())
+                      ->method('union')
+                      ->with($this->equalTo('(query)'), $this->equalTo('DISTINCT'))
+                      ->will($this->returnSelf());
+
+        $this->class->union('query', 'DISTINCT');
+    }
+
      /**
      * Test union() all.
      *
@@ -225,12 +245,52 @@ class MySQLSimpleDMLQueryBuilderSelectTest extends MySQLSimpleDMLQueryBuilderTes
 
         $this->builder->expects($this->once())
                       ->method('union')
-                      ->with($this->equalTo('(query)', TRUE), $this->equalTo(TRUE))
+                      ->with($this->equalTo('(query)'), $this->equalTo('ALL'))
+                      ->will($this->returnSelf());
+
+        $this->class->union('query', 'ALL');
+    }
+
+    /**
+     * Test union() when parameter passed is TRUE.
+     *
+     * @covers Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder::union
+     */
+    public function testUnionWithTypeTrue(): void
+    {
+        $this->escaper->expects($this->once())
+                      ->method('query_value')
+                      ->with($this->equalTo('query'))
+                      ->will($this->returnValue('(query)'));
+
+        $this->builder->expects($this->once())
+                      ->method('union')
+                      ->with($this->equalTo('(query)'), $this->equalTo(TRUE))
                       ->will($this->returnSelf());
 
         $this->class->union('query', TRUE);
     }
 
+    /**
+     * Test union() when parameter passed is FALSE.
+     *
+     * @covers Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder::union
+     */
+    public function testUnionWithTypeFalse(): void
+    {
+        $this->escaper->expects($this->once())
+                      ->method('query_value')
+                      ->with($this->equalTo('query'))
+                      ->will($this->returnValue('(query)'));
+
+        $this->builder->expects($this->once())
+                      ->method('union')
+                      ->with($this->equalTo('(query)'), $this->equalTo(FALSE))
+                      ->will($this->returnSelf());
+
+        $this->class->union('query', FALSE);
+    }
+
 }
 
 ?>
diff --git a/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php b/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
index 8598aa54e5c2ce0a3cb656a454372ce48dee62b1..999dd1957add1d533a20623bf6b1f7699ded7919 100644
--- a/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
@@ -517,17 +517,18 @@ abstract class SQLDMLQueryBuilder extends DatabaseDMLQueryBuilder
     }
 
     /**
-     * Define a UNION or UNION ALL clause of the SQL statement.
-     *
-     * @param string $sql_query SQL query reference
-     * @param bool   $all       True for ALL or False for empty (default).
-     *
-     * @return SQLDMLQueryBuilder $self Self reference
-     */
-    public function union($sql_query, $all = FALSE)
-    {
-        $base = ($all === TRUE) ? 'UNION ALL' : 'UNION';
-        $this->sql_compound($sql_query, $base);
+    * Define a UNION, UNION DISTINCT or UNION ALL clause of the SQL statement.
+    *
+    * @param string $sql_query SQL query reference
+    * @param string $type      Type of UNION operation to perform.
+    *
+    * @return SQLDMLQueryBuilder $self Self reference
+    */
+    public function union($sql_query, $type = NULL)
+    {
+        $operation = "UNION ".strtoupper($type);
+
+        $this->sql_compound($sql_query, $operation);
         return $this;
     }
 
diff --git a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
index b180e22ed1ac5bebe7b6d0260d1637b987cecfb6..402702a68b10428a87d48cd04522c75ea6574029 100644
--- a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
+++ b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
@@ -119,8 +119,13 @@ abstract class DatabaseDMLQueryBuilderTest extends LunrBaseTest
         $types   = [];
         $types[] = [ 'UNION' ];
         $types[] = [ 'UNION ALL' ];
+        $types[] = [ 'UNION DISTINCT' ];
         $types[] = [ 'EXCEPT' ];
+        $types[] = [ 'EXCEPT ALL' ];
+        $types[] = [ 'EXCEPT DISTINCT' ];
         $types[] = [ 'INTERSECT' ];
+        $types[] = [ 'INTERSECT ALL' ];
+        $types[] = [ 'INTERSECT DISTINCT' ];
 
         return $types;
     }
diff --git a/src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderSelectTest.php b/src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderSelectTest.php
index b6986b6c0adb48bc0cc0de6a8b7532b14b4e8ded..0bbeca299ef30cf02f3b506aa480d0e6b5ead5db 100644
--- a/src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderSelectTest.php
+++ b/src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderSelectTest.php
@@ -176,6 +176,19 @@ class SQLDMLQueryBuilderSelectTest extends SQLDMLQueryBuilderTest
         $this->assertPropertyEquals('compound', 'UNION QUERY');
     }
 
+    /**
+     * Test specifying a UNION DISTINCT statement.
+     *
+     * @depends Lunr\Gravity\Database\Tests\DatabaseDMLQueryBuilderQueryPartsTest::testCompoundQuery
+     * @covers  Lunr\Gravity\Database\SQLDMLQueryBuilder::union
+     */
+    public function testUnionDistinct(): void
+    {
+        $return = $this->class->union('QUERY', 'DISTINCT');
+
+        $this->assertPropertyEquals('compound', 'UNION DISTINCT QUERY');
+    }
+
     /**
      * Test specifying a UNION ALL statement.
      *
@@ -184,7 +197,7 @@ class SQLDMLQueryBuilderSelectTest extends SQLDMLQueryBuilderTest
      */
     public function testUnionAll(): void
     {
-        $return = $this->class->union('QUERY', TRUE);
+        $return = $this->class->union('QUERY', 'ALL');
 
         $this->assertPropertyEquals('compound', 'UNION ALL QUERY');
     }
