Index: openacs-4/packages/openfts-driver/openfts-driver.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/openfts-driver.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/openfts-driver.info 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,43 @@ + + + + + OpenFTS Driver + OpenFTS Drivers + f + t + + + + oracle + postgresql + + Neophytos Demetriou + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/openfts-driver/sql/postgresql/load.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/Attic/load.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/sql/postgresql/load.sql 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,2 @@ +\i /usr/local/src/postgresql-7.1.2/contrib/intarray/_int.sql +\i /usr/local/src/Search-OpenFTS-tcl-0.1/func_pgsql/create_func.sql Index: openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-create.sql 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1 @@ +\i openfts-driver-sc-create.sql Index: openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-drop.sql 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1 @@ +\i openfts-driver-sc-drop.sql \ No newline at end of file Index: openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-create.sql 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,64 @@ +-- +-- ACS-SC Implementation +-- + +select acs_sc_impl__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'openfts-driver' -- impl_owner_name +); + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'search', -- impl_operation_name + 'openfts_driver__search', -- impl_alias + 'TCL' -- impl_pl +); + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'index', -- impl_operation_name + 'openfts_driver__index', -- impl_alias + 'TCL' -- impl_pl +); + + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'unindex', -- impl_operation_name + 'openfts_driver__unindex', -- impl_alias + 'TCL' -- impl_pl +); + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'update_index', -- impl_operation_name + 'openfts_driver__update_index', -- impl_alias + 'TCL' -- impl_pl +); + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'summary', -- impl_operation_name + 'openfts_driver__summary', -- impl_alias + 'TCL' -- impl_pl +); + + +select acs_sc_impl_alias__new( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver', -- impl_name + 'info', -- impl_operation_name + 'openfts_driver__info', -- impl_alias + 'TCL' -- impl_pl +); Index: openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/sql/postgresql/openfts-driver-sc-drop.sql 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,10 @@ +select acs_sc_binding__delete( + 'FtsEngineDriver', -- contract_name + 'openfts-driver' -- impl_name +); + + +select acs_sc_impl__delete( + 'FtsEngineDriver', -- impl_contract_name + 'openfts-driver' -- impl_name +); Index: openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,16 @@ +ad_after_server_initialization search_engine_driver { + + set package_id [apm_package_id_from_key openfts-driver] + + set openfts_tcl_src_path [ad_parameter -package_id $package_id openfts_tcl_src_path search-engine-openfts /usr/local/src/Search-OpenFTS-tcl-0.1] + + set files [glob -nocomplain "${openfts_tcl_src_path}/fts_*.tcl"] + + if { [llength $files] == 0 } { + error "Unable to locate $openfts_tcl_src_path." + } + + foreach file [lsort $files] { + source $file + } +} \ No newline at end of file Index: openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,171 @@ +ad_proc openfts_driver__search { + query + offset + limit +} { + @author Neophytos Demetriou +} { + + set result(count) 0 + set result(ids) "" + set result(stopwords) "" + + + array set self [Search::OpenFTS::new ofts] + if ![array size self] { + error "Search failed." + } + + set opt(rejected) [list] + + if { ![info exists opt(txttid)] || [string equal $opt(txttid) ""] } { + set opt(txttid) $self(TXTTID) + } + + foreach {out tables condition order} [Search::OpenFTS::get_sql self $query opt] break + + if { ![string length $condition] } { + return [array get result] + } + if { [info exists order] && [string length $order] > 0 } { + set order "order by $order" + } else { + set order "" + } + if { ![info exists tables] } { + set tables "" + } + if { [info exists out] && [string length out] > 0 } { + set out ",\n $out" + } else { + set out "" + } + set txttbl [split $opt(txttid) .] + + set sql_count " + select count(*) + from [lindex $txttbl 0]$tables + where $condition" + + set sql_sort " + select $opt(txttid) as id$out + from [lindex $txttbl 0]$tables + where $condition + $order + limit $limit + offset $offset" + + set result(stopwords) $opt(rejected) + set result(count) [db_exec_plsql sql_count $sql_count] + db_foreach sql_sort $sql_sort {lappend result(ids) $id} + return [array get result] + +} + + +ad_proc openfts_driver__index { + tid + txt + {title ""} + {keywords ""} +} { + @author Neophytos Demetriou +} { + + set exists_p [db_0or1row exists_p {select 1 from txt where tid=:tid}] + + if ![set exists_p] { + + db_dml insert_tid {insert into txt (tid) values (:tid)} + + } + array set idx [Search::OpenFTS::Index::new] + + Search::OpenFTS::Index::index idx $tid $txt $title + + return + +} + + +ad_proc openfts_driver__unindex { + tid +} { + @author Neophytos Demetriou +} { + + array set idx [Search::OpenFTS::Index::new] + + Search::OpenFTS::Index::delete idx $tid + + return +} + + + +ad_proc openfts_driver__update_index { + tid + txt + {title ""} + {keywords ""} +} { + @author Neophytos Demetriou +} { + + openfts_driver__unindex $tid + openfts_driver__index $tid $txt $title + + return +} + + + +ad_proc openfts_driver__summary { + query + src +} { + @author Neophytos Demetriou +} { + + if {$src == ""} return + + array set opts " + maxread 200 + maxlen 200 + otag + ctag + dict_opt {Search::OpenFTS::Dict::PorterEng Search::OpenFTS::Dict::UnknownDict} + " + + set opts(query) [DoubleApos $query] + set opts(src) [DoubleApos $src] + + array set fts [Search::OpenFTS::new ofts] + + return [Search::OpenFTS::get_headline fts opts] + +} + + + +ad_proc openfts_driver__info {} { + @author Neophytos Demetriou +} { + array set info { + package_key openfts-driver + version 1.0 + automatic_and_queries_p true + stopwords_p true + } + + return [array get info] + +} + + + + + + + + Index: openacs-4/packages/openfts-driver/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/index.adp 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,8 @@ + +

OpenFTS Driver

+@context_bar@ +
+ + \ No newline at end of file Index: openacs-4/packages/openfts-driver/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/index.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,3 @@ +set context_bar [ad_context_bar] + +ad_return_template \ No newline at end of file Index: openacs-4/packages/openfts-driver/www/admin/destroy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/destroy.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/destroy.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,27 @@ +catch { + set ngroups [db_exec_plsql get_ngroups "select mod from fts_conf where did = -2"] +} + +catch { + db_dml drop_table "drop table txt;" +} + +catch { + db_dml drop_fts_conf "drop table fts_conf;" +} + +catch { + for { set __i 1 } { $__i <= $ngroups } { incr __i } { + db_dml drop_index "drop table index${__i};" + } +} + +catch { + db_dml drop_fts_unknown_lexem "drop table fts_unknown_lexem;" +} + +catch { + db_dml drop_s_fts_unknown_lexem "drop sequence s_fts_unknown_lexem;" +} + +ad_returnredirect "" \ No newline at end of file Index: openacs-4/packages/openfts-driver/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/index.adp 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,15 @@ + + +

OpenFTS Driver Administration

+@context_bar@ +
+ + \ No newline at end of file Index: openacs-4/packages/openfts-driver/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/index.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,7 @@ +set context_bar [ad_context_bar] + +set fts_conf_exists_p [catch { + set ngroups [db_exec_plsql get_ngroups "select count(*) from fts_conf"] +}] + +ad_return_template \ No newline at end of file Index: openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + + Initialize OpenFTS + + @author Neophytos Demetriou + +} { + table_name + table_id + dict + parser + numbergroup + ignore_headline + ignore_id_index + map + use_index_table + use_index_array +} + +array set opt " +txttid ${table_name}.${table_id} +numbergroup $numbergroup +parser $parser +use_index_array $use_index_array +use_index_table $use_index_table +dict [list $dict] +map [list $map] +ignore_id_index [list $ignore_id_index] +ignore_headline [list $ignore_headline] +" + +db_dml create_table "create table $table_name ( $table_id int not null primary key, $use_index_array int\[\] );" + +array set idx [Search::OpenFTS::Index::init opt] + +if {[array size idx] == 0} { + error "QQQ: Init failed" + exit +} + +Search::OpenFTS::Index::create_index idx + +ad_returnredirect "" Index: openacs-4/packages/openfts-driver/www/admin/initialize.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/initialize.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/initialize.adp 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,9 @@ + + +

Initialize OpenFTS Engine

+@context_bar@ +
+ +
+ +
\ No newline at end of file Index: openacs-4/packages/openfts-driver/www/admin/initialize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/initialize.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/admin/initialize.tcl 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,72 @@ +ad_page_contract { + + Initialize OpenFTS + + @author Neophytos Demetriou + +} + +set context_bar [ad_context_bar {Initialize OpenFTS Engine}] + +template::form create openfts_init_form \ + -action initialize-2 + +template::element create openfts_init_form table_name \ + -html "size 40" \ + -label "Table Name" \ + -value "txt" + +template::element create openfts_init_form table_id \ + -html "size 40" \ + -label "ID Column Name" \ + -value "tid" + +template::element create openfts_init_form dict \ + -html "size 40" \ + -label "Dictionaries" \ + -value "Search::OpenFTS::Dict::PorterEng Search::OpenFTS::Dict::UnknownDict" + +template::element create openfts_init_form parser \ + -html "size 40" \ + -label "Parser" \ + -value Search::OpenFTS::Parser + +template::element create openfts_init_form numbergroup \ + -html "size 40" \ + -label "Number of index tables" \ + -value 13 + +template::element create openfts_init_form ignore_headline \ + -html "size 40" \ + -label "Types of lexemes to ignore
while constructing a headline" \ + -value {13 15 16 17 5} + +template::element create openfts_init_form ignore_id_index \ + -html "size 40" \ + -label "Types of lexemes to ignore
while indexing" \ + -value {13 14 12} + +template::element create openfts_init_form map \ + -html "size 40" \ + -label "Mapping of types of lexemes
to dictionaries" \ + -value {19 1 18 1 8 1 7 1 6 1 5 1 4 1} + +template::element create openfts_init_form use_index_table \ + -html "size 40" \ + -label "use_index_table" \ + -value 1 + +template::element create openfts_init_form use_index_array \ + -html "size 40" \ + -label "use_index_array" \ + -value fts_index + +template::element create openfts_init_form submit \ + -widget submit \ + -label "Initialize OpenFTS Engine" + + + + + + Index: openacs-4/packages/openfts-driver/www/doc/INSTALL =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/doc/INSTALL,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/openfts-driver/www/doc/INSTALL 1 Sep 2001 20:33:52 -0000 1.1 @@ -0,0 +1,57 @@ +Last updated: September 1st, 2001 +Maintainer: Neophytos Demetriou (k2pts@cytanet.com.cy) + +- Make sure you have installed all headers (for example, spi.h) + using gmake-install-headers during the PostgreSQL installation. + If you have not installed intarray, please do so now. intarray + is under the contrib directory of the PostgreSQL source code. + +- Download Search-OpenFTS-tcl-0.1.tar.gz from http://openfts.sourceforge.net/ + and save it to /tmp/Search-OpenFTS-tcl-0.1.tar.gz + +- Log in as the root user: + + su - + +- Untar the archive file: + + cd /usr/local/src + tar -xzvf /tmp/Search-OpenFTS-tcl-0.1.tar.gz + + +- Install the OpenFTS AOLServer module: + + chown -R nsadmin.web Search-OpenFTS-tcl-0.1/ + cd Search-OpenFTS-tcl-0.1/ + ./configure --with-aolserver-src=AOLSERVER_SRC_DIR + make + cd aolserver + make + cp nsfts.so AOLSERVER_BIN_DIR + +- Edit nsd.tcl file and add entry for nsfts module: + + ns_param nssock ${bindir}/nssock.so + ns_param nslog ${bindir}/nslog.so + ... + ns_param nsfts ${bindir}/nsfts.so + + + +- Load intarray and func_pgsql + + Edit load.sql under the openfts-driver/sql/postgresql directory. + psql -f load.sql your-database-name + +- Install and mount the openfts-driver package + +- Restart AOLserver + +- Go to the administration page and initialize the OpenFTS engine by clicking on the appropriate link. + +- Visit the acs-service-contract package page. If the search package is installed, you will see + a list item under "Valid Uninstalled Bindings" between FtsEngineDriver and openfts-driver. Install it + by clicking on the appropriate link. [Note: We will automate this before the final release of OpenACS-4.x] + + +