Diffusion search - how to do case insensitive search?

Hi,

Seemingly searching in Diffussion is case sensitive. I wonder how to search case insensitively in Diffusion. Thanks!

Hello everybody,

I’m testing phabricator and check if all needs are covered by this amazing tool before installing in my company.

I’m trying to use it to search inside repository, but the search seems to be case sensitive. Like @Peter_Shan, I would like to have capability to use search in repository with case insensitive, so do you have an idea to do it.

Thanks

I noted this on https://secure.phabricator.com/T13339.

1 Like

Thanks

Hello

I made simple modification to be case insensitive :

DiffusionSearchQueryConduitAPIMethod.php
line 66 : 'grep --extended-regexp --null -n --no-color --ignore-case -f - %s -- %s',
line 106 : 'grep --rev %s --print0 --ignore-case --line-number -- %s %s',

DiffusionPatternSearchView.php
line 35: '('.$pattern.')ui',

Result :
image

git diff :

diff --git a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
index e2c56bb0f..703973f0d 100644
--- a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
@@ -63,7 +63,7 @@ final class DiffusionSearchQueryConduitAPIMethod
     $results = array();
     $future = $repository->getLocalCommandFuture(
       // NOTE: --perl-regexp is available only with libpcre compiled in.
-      'grep --extended-regexp --null -n --no-color -f - %s -- %s',
+      'grep --extended-regexp --null -n --no-color --ignore-case -f - %s -- %s',
       $drequest->getStableCommit(),
       $path);

@@ -103,7 +103,7 @@ final class DiffusionSearchQueryConduitAPIMethod

     $results = array();
     $future = $repository->getLocalCommandFuture(
-      'grep --rev %s --print0 --line-number -- %s %s',
+      'grep --rev %s --print0 --ignore-case --line-number -- %s %s',
       hgsprintf('ancestors(%s)', $drequest->getStableCommit()),
       $grep,
       $path);
diff --git a/src/applications/diffusion/view/DiffusionPatternSearchView.php b/src/applications/diffusion/view/DiffusionPatternSearchView.php
index 39a1df4e8..d0e2ac868 100644
--- a/src/applications/diffusion/view/DiffusionPatternSearchView.php
+++ b/src/applications/diffusion/view/DiffusionPatternSearchView.php
@@ -32,7 +32,7 @@ final class DiffusionPatternSearchView extends DiffusionView {

       $matches = null;
       $count = @preg_match_all(
-        '('.$pattern.')u',
+        '('.$pattern.')ui',
         $string,
         $matches,
         PREG_OFFSET_CAPTURE);