You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by vo...@apache.org on 2020/08/04 23:37:37 UTC

[druid] branch master updated: change search filter to includes (#10141)

This is an automated email from the ASF dual-hosted git repository.

vogievetsky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bb198e  change search filter to includes (#10141)
4bb198e is described below

commit 4bb198eb4cf87138181db54f46f29ac78b2cb842
Author: keefe roedersheimer <kr...@gmail.com>
AuthorDate: Tue Aug 4 19:37:07 2020 -0400

    change search filter to includes (#10141)
---
 web-console/src/utils/general.spec.ts | 2 +-
 web-console/src/utils/general.tsx     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/web-console/src/utils/general.spec.ts b/web-console/src/utils/general.spec.ts
index 264554f..b9f4788 100644
--- a/web-console/src/utils/general.spec.ts
+++ b/web-console/src/utils/general.spec.ts
@@ -50,7 +50,7 @@ describe('general', () => {
           id: 'datasource',
           value: `hello`,
         }),
-      ).toMatchInlineSnapshot(`"LOWER(\\"datasource\\") LIKE LOWER('hello%')"`);
+      ).toMatchInlineSnapshot(`"LOWER(\\"datasource\\") LIKE LOWER('%hello%')"`);
 
       expect(
         sqlQueryCustomTableFilter({
diff --git a/web-console/src/utils/general.tsx b/web-console/src/utils/general.tsx
index 1ff1eaf..77c44be 100644
--- a/web-console/src/utils/general.tsx
+++ b/web-console/src/utils/general.tsx
@@ -89,7 +89,7 @@ export function makeBooleanFilter(): FilterRender {
 
 interface NeedleAndMode {
   needle: string;
-  mode: 'exact' | 'prefix';
+  mode: 'exact' | 'includes';
 }
 
 function getNeedleAndMode(input: string): NeedleAndMode {
@@ -101,7 +101,7 @@ function getNeedleAndMode(input: string): NeedleAndMode {
   }
   return {
     needle: input.startsWith(`"`) ? input.substring(1) : input,
-    mode: 'prefix',
+    mode: 'includes',
   };
 }
 
@@ -113,7 +113,7 @@ export function booleanCustomTableFilter(filter: Filter, value: any): boolean {
   if (needleAndMode.mode === 'exact') {
     return needle === haystack;
   }
-  return haystack.startsWith(needle);
+  return haystack.includes(needle);
 }
 
 export function sqlQueryCustomTableFilter(filter: Filter): string {
@@ -123,7 +123,7 @@ export function sqlQueryCustomTableFilter(filter: Filter): string {
   if (needleAndMode.mode === 'exact') {
     return `${columnName} = '${needle}'`;
   } else {
-    return `LOWER(${columnName}) LIKE LOWER('${needle}%')`;
+    return `LOWER(${columnName}) LIKE LOWER('%${needle}%')`;
   }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org