Ignore:
Timestamp:
Jan 18, 2005, 3:28:47 PM (19 years ago)
Author:
gweltas
Message:
  • Author included in "all words" search
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r698 r707  
    426426        $clauses = array();
    427427       
    428         $textfields = array('file', 'name', 'comment', 'keywords', 'author');
    429         foreach ($textfields as $textfield)
    430         {
    431           if (isset($search['fields'][$textfield]))
     428        // Author Search
     429          if (isset($search['fields']['author']))
    432430          {
    433431            $local_clauses = array();
    434             foreach ($search['fields'][$textfield]['words'] as $word)
     432            foreach ($search['fields']['author']['words'] as $word)
    435433            {
    436               array_push($local_clauses, $textfield." LIKE '%".$word."%'");
     434              array_push($local_clauses, "author LIKE '%".$word."%'");
    437435            }
    438436            // adds brackets around where clauses
    439437            array_walk($local_clauses,create_function('&$s','$s="(".$s.")";'));
    440438            array_push($clauses,
    441                        implode(' '.$search['fields'][$textfield]['mode'].' ',
     439                       implode(' '.$search['fields']['author']['mode'].' ',
    442440                               $local_clauses));
    443441          }
    444         }
    445 
     442
     443        // All words search (author included)
    446444        if (isset($search['fields']['allwords']))
    447445        {
    448           $fields = array('file', 'name', 'comment', 'keywords');
     446                  $textfields = array('file', 'name', 'comment', 'keywords', 'author');
    449447          // in the OR mode, request bust be :
    450448          // ((field1 LIKE '%word1%' OR field2 LIKE '%word1%')
     
    458456          {
    459457            $field_clauses = array();
    460             foreach ($fields as $field)
     458            foreach ($textfields as $field)
    461459            {
    462460              array_push($field_clauses, $field." LIKE '%".$word."%'");
Note: See TracChangeset for help on using the changeset viewer.