Page MenuHomePhorge

Remove duplicate Query search tokens before constructing SQL queries
Changes PlannedPublic

Authored by aklapper on Tue, Jun 3, 10:42.

Details

Summary

Avoid unneeded duplicate conditions in SQL SELECT queries in the Global Search when there are duplicate search tokens by removing them before constructing the SQL queries.

Closes T16094

Test Plan
  1. Go to http://phorge.localhost/search/query/advanced/ and enter some duplicated search tokens in the Query field. Also try with operators and quoted search tokens.
  2. Use Dark Console to analyze resulting SQL queries, or check the return values of buildFerretSelectClause(), buildFerretJoinClause(), buildFerretWhereClause() in PhabricatorCursorPagedPolicyAwareQuery.

Diff Detail

Repository
rP Phorge
Branch
dupQuerySearchTerms (branched from master)
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 2050
Build 2050: arc lint + arc unit

Unit TestsFailed

TimeTest
98 msPhutilSearchQueryCompilerTestCase::testCompileQueriesWithFunctions
Assertion failed, expected values to be equal (at PhutilSearchQueryCompilerTestCase.php:303): Function compilation of query: cat title:="Meow Meow" Expected vs Actual Output Diff --- Old Value
848 msPhabricatorCelerityTestCase::testCelerityMaps
1 assertion passed.
869 msPhabricatorConduitTestCase::testConduitMethods
1 assertion passed.
381 msPhabricatorInfrastructureTestCase::testApplicationsInstalled
1 assertion passed.
377 msPhabricatorInfrastructureTestCase::testRejectMySQLNonUTF8Queries
1 assertion passed.
View Full Test Results (1 Failed · 11 Passed)

Event Timeline

aklapper requested review of this revision.Tue, Jun 3, 10:42

Pasting full unit test output here before garbage collection kicks in:

Assertion failed, expected values to be equal (at PhutilSearchQueryCompilerTestCase.php:303): Function compilation of query: cat title:="Meow Meow"
Expected vs Actual Output Diff
--- Old Value
+++ New Value
@@ -1,18 +1 @@
-Array
-(
-    [0] => Array
-        (
-            [0] => 
-            [1] => and
-            [2] => cat
-        )
-
-    [1] => Array
-        (
-            [0] => title
-            [1] => exact
-            [2] => Meow Meow
-        )
-
-)
-
+false