Index: openacs-4/packages/forums/lib/search/search-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/forums/lib/search/search-chunk-oracle.xql 27 Jan 2018 17:01:38 -0000 1.4 +++ openacs-4/packages/forums/lib/search/search-chunk-oracle.xql 15 Jun 2018 20:55:28 -0000 1.5 @@ -6,36 +6,18 @@ select forums_messages.*, - person.name(forums_messages.user_id) as user_name, to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, 100 as the_score from forums_messages, forums_forums where forums_messages.forum_id = forums_forums.forum_id and forums_forums.package_id = :package_id - and forums_messages.state = 'approved' + and (:forum_id is null or forums_forums.forum_id = :forum_id) + and forums_messages.state = 'approved' and upper(forums_messages.subject || ' ' || dbms_lob.substr(forums_messages.content,2500) || ' ' || person.name(forums_messages.user_id)) like upper(:search_pattern) order by forums_messages.posting_date desc - - - select forums_messages.*, - person.name(forums_messages.user_id) as user_name, - to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, - 100 as the_score - from forums_messages, - forums_forums - where forums_forums.forum_id = :forum_id - and forums_forums.package_id = :package_id - and forums_messages.forum_id = forums_forums.forum_id - and forums_messages.state = 'approved' - and upper(forums_messages.subject || ' ' || dbms_lob.substr(forums_messages.content,3500) || ' ' || person.name(forums_messages.user_id)) - like upper(:search_pattern) - order by forums_messages.posting_date desc - - - Index: openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql 7 Aug 2017 23:48:11 -0000 1.2 +++ openacs-4/packages/forums/lib/search/search-chunk-postgresql.xql 15 Jun 2018 20:55:28 -0000 1.3 @@ -6,36 +6,18 @@ select forums_messages.*, - person__name(forums_messages.user_id) as user_name, to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, 100 as the_score from forums_messages, forums_forums where forums_messages.forum_id = forums_forums.forum_id - and forums_forums.package_id = :package_id + and (:forum_id is null or forums_forums.forum_id = :forum_id) + and forums_forums.package_id = :package_id and forums_messages.state = 'approved' and forums_messages.subject || ' ' || forums_messages.content || ' ' || person__name(forums_messages.user_id) ilike :search_pattern order by forums_messages.posting_date desc - - - select forums_messages.*, - person__name(forums_messages.user_id) as user_name, - to_char(forums_messages.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, - 100 as the_score - from forums_messages, - forums_forums - where forums_forums.forum_id = :forum_id - and forums_forums.package_id = :package_id - and forums_messages.forum_id = forums_forums.forum_id - and forums_messages.state = 'approved' - and forums_messages.subject || ' ' || forums_messages.content || ' ' || person__name(forums_messages.user_id) - ilike :search_pattern - order by forums_messages.posting_date desc - - - Index: openacs-4/packages/forums/lib/search/search-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/search/search-chunk.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/forums/lib/search/search-chunk.tcl 22 May 2018 15:27:35 -0000 1.12 +++ openacs-4/packages/forums/lib/search/search-chunk.tcl 15 Jun 2018 20:55:28 -0000 1.13 @@ -5,6 +5,7 @@ @cvs-id $Id$ } + set package_id [ad_conn package_id] set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] @@ -33,25 +34,22 @@ ad_script_abort } - set query search_all_forums - if {$forum_id ne ""} { - set query search_one_forum - if {![string is integer -strict $forum_id]} { - ns_log warning "forum_id <$forum_id> is not an integer: probably a security check or an attempted injection" - set name forum_id - ad_page_contract_handle_datasource_error [_ acs-tcl.lt_name_is_not_an_intege] - ad_script_abort - } + if {$forum_id ne "" && ![string is integer -strict $forum_id]} { + ns_log warning "forum_id <$forum_id> is not an integer: probably a security check or an attempted injection" + set name forum_id + ad_page_contract_handle_datasource_error [_ acs-tcl.lt_name_is_not_an_intege] + ad_script_abort } if { [parameter::get -parameter UseIntermediaForSearchP -default 0] } { append query "_intermedia" } set search_pattern "%${search_text}%" - db_multirow -extend { author posting_date_pretty} messages $query {} { + db_multirow -extend { author posting_date_pretty } messages search_all_forums {} { set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] - set author [expr {$useScreenNameP ? [acs_user::get_element -user_id $user_id -element screen_name] : $user_name}] + set author [acs_user::get_element -user_id $user_id \ + -element [expr {$useScreenNameP ? "screen_name" : "name"}]] } } else { set messages:rowcount 0