Changeset 4962
- Timestamp:
- 09/17/09 15:27:21 (3 years ago)
- Location:
- trunk/SearchEngineKinoSearchAddOn
- Files:
-
- 4 edited
-
lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/Config.spec (modified) (1 diff)
-
lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/Index.pm (modified) (5 diffs)
-
lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/KinoSearch.pm (modified) (3 diffs)
-
test/unit/SearchEngineKinoSearchAddOn/KinoSearchTests.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SearchEngineKinoSearchAddOn/lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/Config.spec
r4913 r4962 14 14 # For example: Web.SomeTopic.AnAttachment.txt, Web.OtherTopic.OtherAttachment.pdf 15 15 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipAttachments} = ''; 16 17 # **STRING** 18 # List of topics to skip. 19 # Topics can be in the form of Web.MyTopic, or if you want a topic to be excluded from all webs just enter MyTopic. 20 # For example: Main.WikiUsers, WebStatistics 21 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipTopics} = ''; 16 22 17 23 # **STRING** -
trunk/SearchEngineKinoSearchAddOn/lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/Index.pm
r4914 r4962 47 47 48 48 # FIXME: Make it more clear. 49 $self->{Debug} = $debug ;49 $self->{Debug} = $debug || $Foswiki::cfg{SearchEngineKinoSearchAddOn}{Debug} || 0; 50 50 51 51 $self->log( "Indexing started", 1 ); … … 59 59 60 60 my @webs = $self->websToIndex(); 61 62 # get the list of topics not to be indexed 63 my %skipTopics = $self->skipTopics; 61 64 62 65 foreach my $web (@webs) { … … 66 69 67 70 foreach my $topic ( Foswiki::Func::getTopicList($web) ) { 71 next if ( ( $skipTopics{"$web.$topic"} ) || ( $skipTopics{$topic} ) ); 72 68 73 $self->log("Indexing topic | $web.$topic"); 69 74 $self->indexTopic( $invindexer, $web, $topic, %fldNames ); … … 206 211 my @topicsToUpdate; 207 212 213 # get the list of topics not to be indexed 214 my %skipTopics = $self->skipTopics; 215 208 216 # do not process the same topic twice 209 217 my %exclude; … … 216 224 my ( $topicName, $userName, $changeTime, $revision ) = 217 225 split( /\t/, $change ); 226 227 next if ( ( $skipTopics{"$web.$topicName"} ) || ( $skipTopics{$topicName} ) ); 218 228 219 229 if ( ( !%exclude ) || ( !$exclude{$topicName} ) ) { -
trunk/SearchEngineKinoSearchAddOn/lib/Foswiki/Contrib/SearchEngineKinoSearchAddOn/KinoSearch.pm
r4835 r4962 62 62 $self->{Log}->print( "| $logtime | $logString\n"); 63 63 64 print STDERR "$logString\n";64 #print STDERR "$logString\n"; 65 65 } 66 $self->{Debug} && Foswiki::Func::writeDebug( $logString ); 66 67 } 67 68 … … 125 126 # QS 126 127 sub skipAttachments { 127 # SMELL: whats the best way to define skipped attachments?128 128 my $to_skip = $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipAttachments} || ''; 129 129 my %skipattachments; … … 136 136 } 137 137 138 # List of topics to be skipped. 139 sub skipTopics { 140 my $to_skip = $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipTopics} || ''; 141 my %skiptopics; 142 143 foreach my $t ( split( /\,\s+/, $to_skip ) ) { 144 $skiptopics{$t} = 1; 145 } 146 147 return %skiptopics; 148 } 149 138 150 # List of file extensions to be indexed 139 151 # QS 140 152 sub indexExtensions { 141 my $extensions = $Foswiki::cfg{SearchEngineKinoSearchAddOn}{IndexExtensions} || ". pdf, .doc, .xml, .html, .txt, .xls, .ppt";153 my $extensions = $Foswiki::cfg{SearchEngineKinoSearchAddOn}{IndexExtensions} || ".txt, .html, .xml, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf"; 142 154 my %indexextensions; 143 155 -
trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn/KinoSearchTests.pm
r4935 r4962 118 118 119 119 my @config_atts = ("att1", "att2"); 120 my $a_att;121 120 122 121 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipAttachments} = ""; … … 127 126 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipAttachments} = "att1, att2"; 128 127 %atts = $ks->skipAttachments(); 129 foreach $a_att (@config_atts) {128 foreach my $a_att (@config_atts) { 130 129 $this->assert($atts{$a_att}, "Attachment $a_att not skipped in config.") 130 } 131 } 132 133 sub test_skipTopics { 134 my $this = shift; 135 my $ks = new Foswiki::Contrib::SearchEngineKinoSearchAddOn::KinoSearch("index"); 136 137 my @config_atts = ("Web.MyTopic", "MyOtherTopic"); 138 139 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipTopics} = ""; 140 my %atts = $ks->skipTopics(); 141 my $num = %atts; 142 $this->assert($num == 0, "List of skipped attachments not empty. : $num"); 143 144 $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipTopics} = "Web.MyTopic, MyOtherTopic"; 145 %atts = $ks->skipTopics(); 146 foreach my $t (@config_atts) { 147 $this->assert($atts{$t}, "Topic $t not skipped in config.") 131 148 } 132 149 }
Note: See TracChangeset
for help on using the changeset viewer.
