Option to enable %keyword% search by default

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eddieadams
    Junior Member
    • Apr 2015
    • 16

    Option to enable %keyword% search by default

    Is there an option to enable %keyword% search by default... if not which files to edit?
  • yuri
    Member
    • Mar 2014
    • 8442

    #2


    The end of the first section.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • eddieadams
      Junior Member
      • Apr 2015
      • 16

      #3
      Awesome

      /#Admin/settings
      Use 'contains' operator when filtering varchar fields
      If not checked then 'starts with' operator is used. You can use the wildcard '%'.

      Comment

      • rinorway
        Senior Member
        • Feb 2016
        • 179

        #4
        It would be nice to have an option to prefix the % in the search as option indeed as suggested below.


        ---------------------------
        From the Espocrm.com customer portal documents/tips section :

        Open file application/Espo/Controllers/GlobalSearch.php


        Find:

        $query = $request->get('q');

        Add content below:

        $query = trim($query, '%');
        $query = '%'. $query .'%';
        Do the initial trim in case someone has already added the wildcard to the beginning or end, since this makes it a global wildcard.
        You can also do it on the record list as well by making the very simple change below.

        Open file application/Espo/Core/SelectManagers/Base.php

        Go to line 1248 and change...

        $expression = $textFilter . '%';

        to

        $expression = '%'. $textFilter . '%';

        Comment

        • esforim
          Active Community Member
          • Jan 2020
          • 2204

          #5
          So this code will basically allow using to use Filter type of search on the Global Search? Is that right?

          Comment

          Working...