Index: openacs-4/packages/cms/www/modules/search/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/index-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cms/www/modules/search/index-oracle.xql 8 Sep 2001 15:16:50 -0000 1.1 @@ -0,0 +1,62 @@ + + + + oracle8.1.6 + + + + + ${the_or}%[string tolower $word]% within \$field + + + + + + + + $the_or contains($column_name, '$search_clause', $label) > 0 + + + + + + + + $the_plus score($label) + + + + + + + + select + i.item_id, content_item.get_path(i.item_id) item_path, + r.revision_id, + t.pretty_name as pretty_type, t.object_type, + r.title, to_char(r.publish_date) as pretty_date, + NVL(NVL(m.label, r.mime_type), 'unknown') as pretty_mime_type, + rownum as row_index, + ($score_expr) as search_score + from + cr_items i, cr_revisions r, + cr_mime_types m, acs_object_types t $attrs_table + where + m.mime_type(+) = r.mime_type + and + t.object_type = i.content_type $attrs_where + and + ($contains_clause) + + + + + + + + and r.revision_id(+) = i.live_revision + + + + + Index: openacs-4/packages/cms/www/modules/search/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/index-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cms/www/modules/search/index-postgresql.xql 8 Sep 2001 15:16:50 -0000 1.1 @@ -0,0 +1,63 @@ + + + + postgresql7.1 + + + + + ${the_or}%[string tolower $word]% within \\$field + + + + + + + + $the_or contains($column_name, '$search_clause', $label) > 0 + + + + + + + + $the_plus score($label) + + + + + + + + select + i.item_id, content_item__get_path(i.item_id,null) as item_path, + r.revision_id, + t.pretty_name as pretty_type, t.object_type, + r.title, to_char(r.publish_date,'YYYY-MM-DD') as pretty_date, + coalesce(coalesce(m.label, r.mime_type), 'unknown') as pretty_mime_type, + 1 as row_index, + 1 as search_score + from + cr_items i[ad_decode $live_p 1 " LEFT OUTER JOIN" ,] + cr_revisions r[ad_decode $live_p 1 " ON i.live_revision = r.revision_id" ""] + LEFT OUTER JOIN + cr_mime_types m using (mime_type), + acs_object_types t + where + t.object_type = i.content_type + and + r.revision_id in ([join [content_search__search_ids $keywords] ,]) + + + + + + + + + + + + + Index: openacs-4/packages/cms/www/modules/search/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/search/index.tcl 25 May 2001 02:15:56 -0000 1.2 +++ openacs-4/packages/cms/www/modules/search/index.tcl 8 Sep 2001 15:16:50 -0000 1.3 @@ -68,6 +68,7 @@ foreach word $word_list { append inter_clause "${the_or}%[string tolower $word]%" append within_clause "${the_or}%[string tolower $word]% within \$field" + #append within_clause [db_map within_clause] set the_or "," } @@ -90,38 +91,21 @@ set search_clause $inter_clause set column_name "r.content" } - append contains_clause "$the_or contains($column_name, '$search_clause', $label) > 0" + append contains_clause [db_map contains_clause] set the_or " or " - append score_expr "$the_plus score($label)" + append score_expr [db_map score_expr] set the_plus " +" incr label 10 } # Build the basic query + set live_p [string equal $which_revisions live] + set sql_query [db_map sql_query] - set sql_query " - select - i.item_id, content_item.get_path(i.item_id) item_path, - r.revision_id, - t.pretty_name as pretty_type, t.object_type, - r.title, to_char(r.publish_date) as pretty_date, - NVL(NVL(m.label, r.mime_type), 'unknown') as pretty_mime_type, - rownum as row_index, - ($score_expr) as search_score - from - cr_items i, cr_revisions r, - cr_mime_types m, acs_object_types t $attrs_table - where - m.mime_type(+) = r.mime_type - and - t.object_type = i.content_type $attrs_where - and - ($contains_clause)" - # Append other search parameters to the query - if { [string equal $which_revisions live] } { - append sql_query "\n and r.revision_id(+) = i.live_revision" + if { $live_p } { + append sql_query [db_map live_revision] } else { append sql_query "\n and r.item_id = i.item_id" } Index: openacs-4/packages/cms/www/modules/search/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/index.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/search/index.xql 25 May 2001 23:49:05 -0000 1.1 +++ openacs-4/packages/cms/www/modules/search/index.xql 8 Sep 2001 15:16:50 -0000 1.2 @@ -16,7 +16,7 @@ - select count(*) from ($sql_query) + select count(*) from ($sql_query) x Index: openacs-4/packages/cms/www/modules/search/search-results.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/search-results.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/search/search-results.xql 25 May 2001 23:49:05 -0000 1.1 +++ openacs-4/packages/cms/www/modules/search/search-results.xql 8 Sep 2001 15:16:50 -0000 1.2 @@ -4,7 +4,7 @@ - select * from ($sql_query) + select * from ($sql_query) x where row_index >= :start_row and row_index < (:start_row + :rows_per_page) order by search_score desc, title