[Rt-commit] r19194 - in rt/3.999/branches/config-in-db: etc sbin
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Apr 13 23:58:37 EDT 2009
Author: sunnavy
Date: Mon Apr 13 23:58:36 2009
New Revision: 19194
Modified:
rt/3.999/branches/config-in-db/etc/initialdata
rt/3.999/branches/config-in-db/lib/RT/Model/TicketCollection.pm
rt/3.999/branches/config-in-db/sbin/rt-fulltext-indexer
rt/3.999/branches/config-in-db/sbin/rt-setup-fulltext-index
Log:
name converts and config updates for full_text_search stuff
Modified: rt/3.999/branches/config-in-db/etc/initialdata
==============================================================================
--- rt/3.999/branches/config-in-db/etc/initialdata (original)
+++ rt/3.999/branches/config-in-db/etc/initialdata Mon Apr 13 23:58:36 2009
@@ -666,6 +666,12 @@
'forward_from_user' => 0,
'friendly_from_line_format' => '"%s via RT" <%s>',
'friendly_to_line_format' => '"%s of {{rtname}} Ticket #%s":;',
+ 'full_text_search' => {
+ enable => 0,
+ indexed => 0,
+ # table => 'AttachmentsIndex',
+ # column => 'ftsindex',
+ },
'gnupg' => {
enable => 1,
outgoing_messages_format => 'RFC', # Inline
Modified: rt/3.999/branches/config-in-db/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/3.999/branches/config-in-db/lib/RT/Model/TicketCollection.pm (original)
+++ rt/3.999/branches/config-in-db/lib/RT/Model/TicketCollection.pm Mon Apr 13 23:58:36 2009
@@ -725,8 +725,8 @@
sub _trans_content_limit {
my ( $self, $field, $op, $value, @rest ) = @_;
- my $config = RT->config->get('FullTextSearch') || {};
- return unless $config->{'Enable'};
+ my $config = RT->config->get('full_text_search') || {};
+ return unless $config->{'enable'};
my $txn_alias = $self->join_transactions;
unless ( defined $self->{'_sql_aliases'}{'attachments'} ) {
@@ -741,15 +741,15 @@
$self->open_paren;
- if ( $config->{'Indexed'} ) {
- my $db_type = RT->config->get('DatabaseType');
+ if ( $config->{'indexed'} ) {
+ my $db_type = Jifty->config->framework('Database')->{'Driver'};
my $alias;
- if ( $config->{'Table'} ) {
+ if ( $config->{'table'} ) {
$alias = $self->{'_sql_aliases'}{'full_text'} ||= $self->_sql_join(
type => 'left',
alias1 => $self->{'_sql_aliases'}{'attachments'},
column1 => 'id',
- table2 => $config->{'Table'},
+ table2 => $config->{'table'},
column2 => 'id',
);
} else {
@@ -791,7 +791,7 @@
);
}
- if ( RT->config->get('DontSearchFileAttachments') ) {
+ if ( RT->config->get('dont_search_file_attachments') ) {
$self->_sql_limit(
alias => $self->{'_sql_aliases'}{'attachments'},
column => 'filename',
Modified: rt/3.999/branches/config-in-db/sbin/rt-fulltext-indexer
==============================================================================
--- rt/3.999/branches/config-in-db/sbin/rt-fulltext-indexer (original)
+++ rt/3.999/branches/config-in-db/sbin/rt-fulltext-indexer Mon Apr 13 23:58:36 2009
@@ -71,13 +71,13 @@
exit 1;
}
-my $fts_config = RT->config->get('FullTextSearch') || {};
-unless ( $fts_config->{'Enable'} ) {
+my $fts_config = RT->config->get('full_text_search') || {};
+unless ( $fts_config->{'enable'} ) {
print STDERR "Full text search disabled in the RT config."
." Read documentation for %FullTextSearch config option.";
exit 1;
}
-unless ( $fts_config->{'Indexed'} ) {
+unless ( $fts_config->{'indexed'} ) {
print STDERR "Full text search is enabled in the RT config,"
." however full text search works without special index,"
." so this tool is not required."
@@ -85,7 +85,7 @@
exit 1;
}
-my $db_type = RT->config->get('DatabaseType');
+my $db_type = Jifty->config->framework('Database')->{'Driver'};
my @types = qw(text html);
foreach my $type ( @types ) {
@@ -233,15 +233,15 @@
my $type = shift;
my $attachments = attachments( $type );
my $alias = 'main';
- if ( $fts_config->{'Table'} ) {
+ if ( $fts_config->{'table'} ) {
$alias = $attachments->join(
type => 'left',
column1 => 'id',
- table2 => $fts_config->{'Table'},
+ table2 => $fts_config->{'table'},
column2 => 'id',
);
}
- $attachments->limit( alias => $alias, column => $fts_config->{'Column'}, operator => 'IS NOT', value => 'NULL' );
+ $attachments->limit( alias => $alias, column => $fts_config->{'column'}, operator => 'IS NOT', value => 'NULL' );
$attachments->order_by( column => 'id', order => 'desc' );
my $res = $attachments->first;
return 0 unless $res;
@@ -252,8 +252,8 @@
my ($type, $attachment, $text) = (@_);
my $dbh = Jifty->handle->dbh;
- my $table = $fts_config->{'Table'};
- my $column = $fts_config->{'Column'};
+ my $table = $fts_config->{'table'};
+ my $column = $fts_config->{'column'};
my $query;
if ( $table ) {
Modified: rt/3.999/branches/config-in-db/sbin/rt-setup-fulltext-index
==============================================================================
--- rt/3.999/branches/config-in-db/sbin/rt-setup-fulltext-index (original)
+++ rt/3.999/branches/config-in-db/sbin/rt-setup-fulltext-index Mon Apr 13 23:58:36 2009
@@ -79,12 +79,12 @@
sub warning { Jifty->log->warn(_(@_)); verbose(@_); 1 }
my %default = (
- Table => 'AttachmentsIndex',
- Column => 'fts_index',
+ table => 'AttachmentsIndex',
+ column => 'fts_index',
);
-my $db_type = RT->config->get('DatabaseType');
+my $db_type = Jifty->config->framework('Database')->{'Driver'};
if ( $db_type eq 'mysql' ) {
my $dbh = Jifty->handle->dbh;
@@ -98,7 +98,7 @@
my $table = prompt(
message => 'Enter name of a DB table that will be used to connect to the sphinx server',
- default => $default{'Column'},
+ default => $default{'column'},
);
my $url = prompt(
message => 'Enter URL of the sphinx search server, it should be sphinx://<server>:<port>/<index name>. Simple config for this sphinx instance will be generated for you.',
@@ -109,12 +109,12 @@
CREATE TABLE $table (
id INTEGER NOT NULL,
weight INTEGER NOT NULL,
- $default{'Column'} VARCHAR(3072) NOT NULL,
- INDEX($default{'Column'})
+ $default{'column'} VARCHAR(3072) NOT NULL,
+ INDEX($default{'column'})
) ENGINE=SPHINX CONNECTION="$url"
END
- print_rt_config( Table => $table, Column => $default{'Column'} );
+ print_rt_config( table => $table, column => $default{'column'} );
insert_schema( $schema );
require URI;
@@ -188,11 +188,11 @@
my $schema = <<END;
CREATE TABLE $table (
id INTEGER NOT NULL,
- $default{'Column'} tsvector
+ $default{'column'} tsvector
)
END
- print_rt_config( Table => $table, Column => $default{'Column'} );
+ print_rt_config( table => $table, column => $default{'column'} );
insert_schema( $schema );
@@ -204,11 +204,11 @@
Either run:
- CREATE INDEX ${column}_idx ON $table USING gin($default{'Column'});
+ CREATE INDEX ${column}_idx ON $table USING gin($default{'column'});
or
- CREATE INDEX ${column}_idx ON $table USING gist($default{'Column'});
+ CREATE INDEX ${column}_idx ON $table USING gist($default{'column'});
END
}
@@ -239,11 +239,11 @@
print <<END;
Configure your RT via site config:
-set( %FullTextSearch,
- Enable => 1,
- Indexed => 1,
- Table => '$args{'Table'}',
- Column => '$args{'Column'}',
+set( %full_text_search,
+ enable => 1,
+ indexed => 1,
+ table => '$args{'table'}',
+ column => '$args{'column'}',
);
END
More information about the Rt-commit
mailing list