Changeset 1015 for trunk/include


Ignore:
Timestamp:
Jan 27, 2006, 11:40:51 PM (19 years ago)
Author:
plg
Message:

Search engine redesign, second part :

improvement: in category.php, an icon opening a popup display the list of
search rules.

modification: function get_search_array is responsible of search rules
retrieving from database. This function is called from get_sql_search_clause
and from search_rules.php

modification: ability to search multiple authors. Warning: this version of
search tool can't search author names including any blank space.

File:
1 edited

Legend:

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

    r1012 r1015  
    774774
    775775/**
    776  * returns the SQL clause from a search identifier
    777  *
    778  * Search rules are stored in search table as a serialized array. This array
    779  * need to be transformed into an SQL clause to be used in queries.
     776 * returns search rules stored into a serialized array in "search"
     777 * table. Each search rules set is numericaly identified.
    780778 *
    781779 * @param int search_id
    782  * @return string
    783  */
    784 function get_sql_search_clause($search_id)
     780 * @return array
     781 */
     782function get_search_array($search_id)
    785783{
    786784  if (!is_numeric($search_id))
     
    792790SELECT rules
    793791  FROM '.SEARCH_TABLE.'
    794   WHERE id = '.$_GET['search'].'
     792  WHERE id = '.$search_id.'
    795793;';
    796794  list($serialized_rules) = mysql_fetch_row(pwg_query($query));
    797795 
    798   $search = unserialize($serialized_rules);
    799 
    800 //   echo '<pre>';
    801 //   print_r($search);
    802 //   echo '</pre>';
    803 
     796  return unserialize($serialized_rules);
     797}
     798
     799/**
     800 * returns the SQL clause from a search identifier
     801 *
     802 * Search rules are stored in search table as a serialized array. This array
     803 * need to be transformed into an SQL clause to be used in queries.
     804 *
     805 * @param int search_id
     806 * @return string
     807 */
     808function get_sql_search_clause($search_id)
     809{
     810  $search = get_search_array($search_id);
     811 
    804812  // SQL where clauses are stored in $clauses array during query
    805813  // construction
Note: See TracChangeset for help on using the changeset viewer.