/[suikacvs]/webroot/swe/lib/SWE/DB.pm
Suika

Contents of /webroot/swe/lib/SWE/DB.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Mar 2 12:09:30 2009 UTC (16 years, 1 month ago) by wakaba
Branch: MAIN
++ swe/lib/SWE/ChangeLog	2 Mar 2009 12:08:28 -0000
	* DB.pm: New module.

2009-03-02  Wakaba  <wakaba@suika.fam.cx>

++ swe/lib/suikawiki/ChangeLog	2 Mar 2009 12:09:18 -0000
	* main.pl: Create an instance of the new SWE::DB module and obtain
	references to database objects via that object for newly added
	modes.

2009-03-02  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 package SWE::DB;
2     use strict;
3     use warnings;
4    
5     sub new ($) {
6     my $self = bless {}, shift;
7     return $self;
8     } # new
9    
10     sub sw3db_dir_name : lvalue { $_[0]->{sw3db_dir_name} }
11     sub global_lock_dir_name : lvalue { $_[0]->{global_lock_dir_name} }
12     sub id_dir_name : lvalue { $_[0]->{id_dir_name} }
13     sub name_dir_name : lvalue { $_[0]->{name_dir_name} }
14    
15     sub name_inverted_index ($) {
16     my $self = shift;
17    
18     return $self->{name_inverted_index} ||= do {
19     require SWE::DB::HashedIndex;
20     my $names_index_db = SWE::DB::HashedIndex->new;
21     $names_index_db->{root_directory_name} = $self->name_dir_name;
22     $names_index_db;
23     };
24     } # name_inverted_index
25    
26     sub id_tfidf ($) {
27     my $self = shift;
28    
29     return $self->{id_tfidf} ||= do {
30     require SWE::DB::IDText;
31     my $tfidf_db = SWE::DB::IDText->new;
32     $tfidf_db->{root_directory_name} = $self->id_dir_name;
33     $tfidf_db->{leaf_suffix} = '.tfidf';
34     $tfidf_db;
35     };
36     } # id_tfidf
37    
38     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24