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..156ce2c0e44e50abd1d5245df7b97e54ffa765d0 100644
--- a/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
@@ -808,16 +808,25 @@ 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 $type      Whether to construct UNION, EXCEPT or INTERSECT
+     * @param mixed  $operator  Whether to add ALL, DISTINCT or default
      *
      * @return void
      */
-    protected function sql_compound($sql_query, $base)
+    protected function sql_compound($sql_query, $type, $operator = NULL)
     {
         if ($this->compound != '')
         {
             $this->compound .= ' ';
         }
+        if($operator === 'ALL' || $operator === 'DISTINCT')
+        {
+            $base = $type . " " . $operator;
+        }
+        else
+        {
+            $base = $type;
+        }
 
         $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..ba03aae8198f7f5e30b6b266942d6fbe3dc96a76 100644
--- a/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php
+++ b/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderSelectTest.php
@@ -193,42 +193,22 @@ class MySQLSimpleDMLQueryBuilderSelectTest extends MySQLSimpleDMLQueryBuilderTes
 
     /**
      * Test union().
-     *
+     * @dataProvider unionOperatorProvider
      * @covers Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder::union
      */
-    public function testUnion(): void
+    public function testUnion($operators): void
     {
         $this->escaper->expects($this->once())
                       ->method('query_value')
-                      ->with($this->equalTo('query'))
-                      ->will($this->returnValue('(query)'));
+                      ->with('query')
+                      ->willReturn('(query)');
 
         $this->builder->expects($this->once())
                       ->method('union')
-                      ->with($this->equalTo('(query)'))
-                      ->will($this->returnSelf());
-
-        $this->class->union('query');
-    }
-
-     /**
-     * Test union() all.
-     *
-     * @covers Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder::union
-     */
-    public function testUnionAll(): 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)', TRUE), $this->equalTo(TRUE))
-                      ->will($this->returnSelf());
+                      ->with('(query)', $operators)
+                      ->willReturnSelf();
 
-        $this->class->union('query', TRUE);
+        $this->class->union('query', $operators);
     }
 
 }
diff --git a/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderTest.php b/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderTest.php
index dcfdfaf57ed2c51a5eeaa1e14bf218753b2f666f..dd53f1d20889f0c631c11fc9ddaf93c553a811e7 100644
--- a/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderTest.php
+++ b/src/Lunr/Gravity/Database/MySQL/Tests/MySQLSimpleDMLQueryBuilderTest.php
@@ -93,6 +93,23 @@ abstract class MySQLSimpleDMLQueryBuilderTest extends LunrBaseTest
         return $values;
     }
 
+    /**
+    * Unit test data provider for tested union operators.
+    *
+    * @return array $compound operators for union query
+    */
+    public function unionOperatorProvider(): array
+    {
+        $operators   = [];
+        $operators[] = [ NULL ];
+        $operators[] = [ 'ALL' ];
+        $operators[] = [ 'DISTINCT' ];
+        $operators[] = [ TRUE ];
+        $operators[] = [ FALSE ];
+
+        return $operators;
+    }
+
 }
 
 ?>
diff --git a/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php b/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
index 8598aa54e5c2ce0a3cb656a454372ce48dee62b1..df6913a85513764c9431aa2de3ceec5e9f89918d 100644
--- a/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php
@@ -517,17 +517,16 @@ 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 $operator  UNION operation to perform
+    *
+    * @return SQLDMLQueryBuilder $self Self reference
+    */
+    public function union($sql_query, $operator = NULL)
+    {
+        $this->sql_compound($sql_query, 'UNION', strtoupper($operator));
         return $this;
     }
 
diff --git a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsTest.php b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsTest.php
index 1dcb661843034cf2d9f4547dde12868cd36bdbeb..0c366cfb12f5dc018ec0a1fdf4ef0499d732fd42 100644
--- a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsTest.php
+++ b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsTest.php
@@ -25,16 +25,36 @@ class DatabaseDMLQueryBuilderQueryPartsTest extends DatabaseDMLQueryBuilderTest
     /**
      * Test specifying the UNION part of a query.
      *
-     * @param string $types Compound query operator
+     * @param string $types     Compound query operator
      *
-     * @dataProvider compoundQueryTypeProvider
+     * @dataProvider compoundQueryTypeAndOperatorProvider
      * @covers       Lunr\Gravity\Database\DatabaseDMLQueryBuilder::sql_compound
      */
-    public function testCompoundQuery($types): void
+    public function testCompoundQuery($types, $operator = NULL): void
     {
         $method = $this->get_accessible_reflection_method('sql_compound');
 
-        $method->invokeArgs($this->class, [ '(sql query)', $types ]);
+        $method->invokeArgs($this->class, [ '(sql query)', $types, $operator ]);
+
+        ($operator === NULL) ? $string = $types . ' (sql query)'
+                             : $string = $types . " " . $operator . ' (sql query)';
+
+        $this->assertPropertyEquals('compound', $string);
+    }
+
+    /**
+     * Test specifying the UNION part of a query with invalid parameters.
+     *
+     * @param string $types     Compound query operator
+     *
+     * @dataProvider compoundQueryInvalidTypeAndOperatorProvider
+     * @covers       Lunr\Gravity\Database\DatabaseDMLQueryBuilder::sql_compound
+     */
+    public function testCompoundQueryUnsupportedOperators($types, $operator): void
+    {
+        $method = $this->get_accessible_reflection_method('sql_compound');
+
+        $method->invokeArgs($this->class, [ '(sql query)', $types, $operator ]);
 
         $string = $types . ' (sql query)';
 
diff --git a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
index b180e22ed1ac5bebe7b6d0260d1637b987cecfb6..c9cbf88a3883b686b60d3e3876ee6ec6d0f2c452 100644
--- a/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
+++ b/src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderTest.php
@@ -114,13 +114,28 @@ abstract class DatabaseDMLQueryBuilderTest extends LunrBaseTest
     *
     * @return array $compound Array of compound types
     */
-    public function compoundQueryTypeProvider(): array
+    public function compoundQueryTypeAndOperatorProvider(): array
     {
         $types   = [];
         $types[] = [ 'UNION' ];
-        $types[] = [ 'UNION ALL' ];
-        $types[] = [ 'EXCEPT' ];
-        $types[] = [ 'INTERSECT' ];
+        $types[] = [ 'UNION','ALL' ];
+        $types[] = [ 'UNION','DISTINCT' ];
+
+        return $types;
+    }
+
+    /**
+    * Unit test data provider for common compound queries.
+    *
+    * @return array $compound Array of compound types
+    */
+    public function compoundQueryInvalidTypeAndOperatorProvider(): array
+    {
+        $types   = [];
+        $types[] = [ 'UNION','Some Operator' ];
+        $types[] = [ 'UNION', 0 ];
+        $types[] = [ 'UNION', FALSE ];
+        $types[] = [ 'UNION', TRUE ];
 
         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');
     }
