1 package CXGN
::Tools
::Tsearch
;
7 Functions for working with the Postgres tsearch module used for text indexing
16 Naama Menda (nm249@cornell.edu)
23 Usage: CXGN::Tsearch::process_string('some string' , 1)
24 Desc: a class function for preparing a string for matching to a tsvector field
25 Ret: a processed string
26 Args: string , and optional flag for removing spaces and dots
37 print STDERR
"process string about to replace spaces and dots for string $string ...\n";
38 $string =~ s/\s//g; #replace spaces with nothing
39 $string =~ s/\.//g; #replace dots with nothing - important for a multiple synonym string
42 $string =~ s/\(.*?\)//g;
46 $string =~ s/((\`.*?&)|(\'.*?&))/&/g;
47 $string =~ s/((\`.*?$)|(\'.*?$))//g;
49 $string =~ s/\(|\)//g;
52 #$cvterm_hash->{name} =~ s/(.+?)\s\b(\w*)\/(\w*)\b/$1&$2|$1&$3/;
59 Usage: $cvterm->do_insert($match_type, [pub_id, rank, headline] )
60 Desc: insert a new cvterm_pub_rank or a locus_pub_rank
61 Ret: number of lines stored in _pub_rank table
62 Args: match_type and list of lists
63 Side Effects: calls the store function
72 my @array = @
$array_ref;
76 my $pub_id = @
$ref[0];
78 my $headline=@
$ref[2];
80 #Check that there is not already a locus-publication link with this match type:
81 #Look at the match_type of each row where locus_id and pub_id match the current ones.
82 #If any of these are "name_abstract" then we do not insert our result into the table.
83 $self->set_pub_id($pub_id);
84 $self->set_rank($rank);
85 $self->set_match_type($match_type);
87 $headline =~ s/\'//g; #gets rid of single quotes from headline text
88 $self->set_headline($headline);
89 my $store= $self->store(); #store function should call exists function!
90 if ($store) { $count++ ; }
92 #if (!$array) { $array=0 ; }
93 print STDERR
"Found " .scalar(@array) . " lines. Inserted $count $match_type rows into _pub_ranking table**\n";