Skip to content
Browse files

Now search function look into aliases too.

  • Loading branch information...
1 parent 4d1aead commit 470dda0aa9b783ee7828bb462351094dc1a6d230 stronk7 committed Dec 11, 2004
Showing with 22 additions and 1 deletion.
  1. +22 −1 mod/glossary/sql.php
View
23 mod/glossary/sql.php
@@ -167,10 +167,31 @@
switch ( $mode ) {
case 'search':
+ //First, look in aliases (bug 2242)
+ $idaliases = '';
+ $listaliases = array();
+ $recaliases = get_records_sql ("SELECT al.id, al.entryid
+ FROM {$CFG->prefix}glossary_alias al,
+ {$CFG->prefix}glossary_entries ge
+ WHERE (ge.glossaryid = '$glossary->id' OR
+ ge.sourceglossaryid = '$glossary->id') AND
+ (ge.approved != 0 $userid) AND
+ ge.id = al.entryid AND
+ al.alias $LIKE '%$hook%'");
+ if ($recaliases) {
+ foreach ($recaliases as $recalias) {
+ $listaliases[] = $recalias->entryid;
+ }
+ $idaliases = implode (',',$listaliases);
+ }
$printpivot = 0;
$where = "AND ( ge.concept $LIKE '%$hook%'";
+ //Include aliases in resultset (if any)
+ if (!empty($idaliases)) {
+ $where .= " OR ge.id IN ($idaliases)";
+ }
if ( $fullsearch ) {
- $where .= "OR ge.definition $LIKE '%$hook%')";
+ $where .= " OR ge.definition $LIKE '%$hook%')";
} else {
$where .= ")";
}

0 comments on commit 470dda0

Please sign in to comment.
Something went wrong with that request. Please try again.