We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29180
    • 4 Posts
    I have alphabet A B C D ......... and I have to search by first letter in the Title document
    How can I implement this ?
      • 5811
      • 1,717 Posts
      For that you should hack a little AjaxSearch ...

      In the file classes/search.class.inc.php, set the minChars value to 1:
      with AjaxSearch 1.8.1 line 16 :
      define('MIN_CHARS',1);     // minimum number of characters admitted in case of a wrong &minChars parameter

      with AjaxSearch 1.8.2 line 17 :
      define('MIN_CHARS',1);     // minimum number of characters


      Then around line 439 (1.8.1) Replace :
      'like' => " LIKE '%word%'", 
      by
       'like' => " LIKE 'word%'",
      Here the first % has been canceled.
      With the release 1.8.2 see the same statement around the line 478.

      Then in your snippet call (on the page with the form and on the landing page) add
      &minChars=`1` &whereSearch=`content:pagetitle`

      - &minChars=`1` specify the minimum number of characters available for your search term
      - &whereSearch=`content:pagetitle` restrict the search to the field pagetitle of yours documents

      For instance:
      [!AjaxSearch182? &extract=`99` &parents=`61` &language=`english-utf8` &ajaxSearch=`0` &whereSearch=`content:pagetitle` &AS_showForm=`0` &highlightResult=`0`!] 

      Remove the highlighting (&highlightResult=`0`) or the displaying of the extract (&extract=`0`), otherwise you will probably get lot of letters highlighted