Changeset 25658 for trunk/include/functions_search.inc.php
- Timestamp:
- Nov 23, 2013, 11:57:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_search.inc.php
r25026 r25658 22 22 // +-----------------------------------------------------------------------+ 23 23 24 25 /** 26 * returns search rules stored into a serialized array in "search" 24 /** 25 * @package functions\search 26 */ 27 28 29 /** 30 * Returns search rules stored into a serialized array in "search" 27 31 * table. Each search rules set is numericaly identified. 28 32 * 29 * @param int search_id33 * @param int $search_id 30 34 * @return array 31 35 */ … … 48 52 49 53 /** 50 * returns the SQL clause from a search identifier 51 * 52 * Search rules are stored in search table as a serialized array. This array 53 * need to be transformed into an SQL clause to be used in queries. 54 * 55 * @param array search 54 * Returns the SQL clause for a search. 55 * Transforms the array returned by get_search_array() into SQL sub-query. 56 * 57 * @param array $search 56 58 * @return string 57 59 */ … … 171 173 172 174 /** 173 * returns the list of items corresponding to the advanced search array 174 * 175 * @param array search 175 * Returns the list of items corresponding to the advanced search array. 176 * 177 * @param array $search 178 * @param string $images_where optional additional restriction on images table 176 179 * @return array 177 180 */ 178 function get_regular_search_results($search, $images_where )181 function get_regular_search_results($search, $images_where='') 179 182 { 180 183 global $conf; … … 247 250 } 248 251 249 252 /** 253 * Finds if a char is a letter, a figure or any char of the extended ASCII table (>127). 254 * 255 * @param char $ch 256 * @return bool 257 */ 250 258 function is_word_char($ch) 251 259 { … … 253 261 } 254 262 263 /** 264 * Finds if a char is a special token for word start: [{<=*+ 265 * 266 * @param char $ch 267 * @return bool 268 */ 255 269 function is_odd_wbreak_begin($ch) 256 270 { … … 258 272 } 259 273 274 /** 275 * Finds if a char is a special token for word end: ]}>=*+ 276 * 277 * @param char $ch 278 * @return bool 279 */ 260 280 function is_odd_wbreak_end($ch) 261 281 { … … 263 283 } 264 284 265 define('QST_QUOTED', 0x01); 266 define('QST_NOT', 0x02); 267 define('QST_WILDCARD_BEGIN',0x04); 268 define('QST_WILDCARD_END', 0x08); 285 286 define('QST_QUOTED', 0x01); 287 define('QST_NOT', 0x02); 288 define('QST_WILDCARD_BEGIN', 0x04); 289 define('QST_WILDCARD_END', 0x08); 269 290 define('QST_WILDCARD', QST_WILDCARD_BEGIN|QST_WILDCARD_END); 270 291 271 272 /** 273 * analyzes and splits the quick/query search query $q into tokens 292 /** 293 * Analyzes and splits the quick/query search query $q into tokens. 274 294 * q='john bill' => 2 tokens 'john' 'bill' 275 295 * Special characters for MySql full text search (+,<,>,~) appear in the token modifiers. 276 296 * The query can contain a phrase: 'Pierre "New York"' will return 'pierre' qnd 'new york'. 297 * 298 * @param string $q 299 * @param array &$qtokens 300 * @param array &$qtoken_modifiers 277 301 */ 278 302 function analyse_qsearch($q, &$qtokens, &$qtoken_modifiers) … … 369 393 } 370 394 371 372 /** 373 * returns the LIKE sql clause corresponding to the quick search query 374 * that has been split into tokens 395 /** 396 * Returns the LIKE SQL clause corresponding to the quick search query 397 * that has been split into tokens. 375 398 * for example file LIKE '%john%' OR file LIKE '%bill%'. 399 * 400 * @param array $tokens 401 * @param array $token_modifiers 402 * @param string $field 403 * @return string|null 376 404 */ 377 405 function get_qsearch_like_clause($tokens, $token_modifiers, $field) … … 394 422 395 423 /** 396 */ 424 * Returns tags corresponding to the quick search query that has been split into tokens. 425 * 426 * @param array $tokens 427 * @param array $token_modifiers 428 * @param array &$token_tag_ids 429 * @param array &$not_tag_ids 430 * @param array &$all_tags 431 */ 397 432 function get_qsearch_tags($tokens, $token_modifiers, &$token_tag_ids, &$not_tag_ids, &$all_tags) 398 433 { … … 547 582 usort($all_tags, 'tag_alpha_compare'); 548 583 foreach ( $all_tags as &$tag ) 584 { 549 585 $tag['name'] = trigger_event('render_tag_name', $tag['name']); 550 } 551 552 /** 553 * returns the search results corresponding to a quick/query search. 586 } 587 } 588 589 /** 590 * Returns the search results corresponding to a quick/query search. 554 591 * A quick/query search returns many items (search is not strict), but results 555 592 * are sorted by relevance unless $super_order_by is true. Returns: 556 * array ( 557 * 'items' => array(85,68,79...) 558 * 'qs' => array( 559 * 'matching_tags' => array of matching tags 560 * 'matching_cats' => array of matching categories 561 * 'matching_cats_no_images' =>array(99) - matching categories without images 562 * )) 563 * 564 * @param string q 565 * @param bool super_order_by 566 * @param string images_where optional aditional restriction on images table 593 * array ( 594 * 'items' => array of matching images 595 * 'qs' => array( 596 * 'matching_tags' => array of matching tags 597 * 'matching_cats' => array of matching categories 598 * 'matching_cats_no_images' =>array(99) - matching categories without images 599 * ) 600 * ) 601 * 602 * @param string $q 603 * @param bool $super_order_by 604 * @param string $images_where optional additional restriction on images table 567 605 * @return array 568 606 */ … … 764 802 765 803 /** 766 * returns an array of 'items' corresponding to the search id 767 * 768 * @param int search id 769 * @param string images_where optional aditional restriction on images table 804 * Returns an array of 'items' corresponding to the search id. 805 * It can be either a quick search or a regular search. 806 * 807 * @param int $search_id 808 * @param bool $super_order_by 809 * @param string $images_where optional aditional restriction on images table 770 810 * @return array 771 811 */ … … 783 823 } 784 824 } 825 785 826 ?>
Note: See TracChangeset
for help on using the changeset viewer.