Namazu-devel-ja(旧)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OLE filter doesn't use keyword of property (namazu-bugs-ja#120)



Full_Name: Shohei TAKASHIRO
Version: 2.0.10
OS: Windows 95
Submission from: (NULL) (218.47.59.180)


高城と申します。

Office 文書のインデックスを OLE フィルタを使って作成したところ,
Office 文書のキーワードプロパティが、重みづけ情報として使用されません.

環境は以下の通りです.

Windows 95
Office 98
Namazu 2.0.10
# $Id: olemsword.pl,v 1.8.4.1 2001/11/29 11:46:48 takesako Exp $
# $Id: oleexcel.pl,v 1.11.4.1 2001/11/29 11:46:48 takesako Exp $
# $Id: olepowerpoint.pl,v 1.8.4.1 2001/11/29 11:46:48 takesako Exp $

即席パッチを作りましたので,よろしければ御活用ください.
Id 86 のバグ報告と修正の内容が大部分被っていますが、独立したパッチと
なっています。
# ですので、二つとも適用する場合は「手パッチ」が必要になるかもしれません。

-- 
高城 正平@元長野高専
takavoid@xxxxxxxxxxxxxxxxxxx
http://www-suzuki-lab.ei.nagano-nct.ac.jp/old/s2000/j96019/


diff -urN namazu.orig/share/namazu/filter/win32/oleexcel.pl
namazu/share/namazu/filter/win32/oleexcel.pl
--- namazu.orig/share/namazu/filter/win32/oleexcel.pl	Sun Dec 30 23:20:42 2001
+++ namazu/share/namazu/filter/win32/oleexcel.pl	Thu Mar 14 15:10:20 2002
@@ -98,8 +98,8 @@
     return;
 }
 
-sub getProperties ($$) {
-    my ($cfile, $fields) = @_;
+sub getProperties ($$$) {
+    my ($cfile, $fields, $weighted_str) = @_;
 
     # See VBA online help using Microsoft Excel in detail.
     # Topic item: 'DocumentProperty Object'.
@@ -122,6 +122,11 @@
     # $fields->{'date'} = codeconv::shiftjis_to_eucjp($date)
     #     if (defined $date);
 
+    my $keyword = $cfile->BuiltInDocumentProperties('keywords')->{Value};
+    $keyword = codeconv::shiftjis_to_eucjp($keyword);
+    my $weight = $conf::Weight{'metakey'};
+    $$weighted_str .= "\x7f$weight\x7f$keyword\x7f/$weight\x7f\n";
+
     return undef;
 }
 
@@ -170,7 +175,7 @@
     return "$fileName: cannot open file\n" unless (defined $Book);
 
     # get some properties
-    getProperties($Book, $fields);
+    getProperties($Book, $fields, $weighted_str);
 
     # FileHandle for temporary file 1,2
     local (*FH1, *FH2);
diff -urN namazu.orig/share/namazu/filter/win32/olemsword.pl
namazu/share/namazu/filter/win32/olemsword.pl
--- namazu.orig/share/namazu/filter/win32/olemsword.pl	Sun Dec 30 23:20:42 2001
+++ namazu/share/namazu/filter/win32/olemsword.pl	Thu Mar 14 15:37:00 2002
@@ -93,7 +93,7 @@
 
     $cfile =~ s/\//\\/g;
     $$cont = "";
-    ReadMSWord::ReadMSWord($cfile, $cont, $fields);
+    ReadMSWord::ReadMSWord($cfile, $cont, $fields, $weighted_str);
     $cfile = defined $orig_cfile ? $$orig_cfile : '';
 
     gfilter::line_adjust_filter($cont);
@@ -124,8 +124,8 @@
     return 1;
 }
 
-sub getProperties ($$) {
-    my ($cfile, $fields) = @_;
+sub getProperties ($$$) {
+    my ($cfile, $fields, $weighted_str) = @_;
 
     # See VBA online help using Microsoft Word in detail.
     # Topic item: 'DocumentProperty Object'.
@@ -147,14 +147,19 @@
 #	unless (defined $date);
 #    $fields->{'date'} = codeconv::shiftjis_to_eucjp($date) if (defined
$date);
 
+    my $keyword = $cfile->BuiltInDocumentProperties('keywords')->{Value};
+    $keyword = codeconv::shiftjis_to_eucjp($keyword);
+    my $weight = $conf::Weight{'metakey'};
+    $$weighted_str .= "\x7f$weight\x7f$keyword\x7f/$weight\x7f\n";
+
     return undef;
 }
 
 package ReadMSWord;
 
 my $word;
-sub ReadMSWord ($$$) {
-    my ($cfile, $cont, $fields) = @_;
+sub ReadMSWord ($$$$) {
+    my ($cfile, $cont, $fields, $weighted_str) = @_;
 
     # Copy From Win32::OLE Example Program
     # use existing instance if Word is already running
@@ -187,7 +192,7 @@
 	});
     die "Cannot open File $cfile" unless (defined $doc) ;
 
-    olemsword::getProperties($doc, $fields);
+    olemsword::getProperties($doc, $fields, $weighted_str);
     getParagraphs($doc, $cont);
     getFrames($doc, $cont);
     getShapes($doc, $cont);
diff -urN namazu.orig/share/namazu/filter/win32/olepowerpoint.pl
namazu/share/namazu/filter/win32/olepowerpoint.pl
--- namazu.orig/share/namazu/filter/win32/olepowerpoint.pl	Sun Dec 30 23:20:42
2001
+++ namazu/share/namazu/filter/win32/olepowerpoint.pl	Thu Mar 14 15:39:20 2002
@@ -93,7 +93,7 @@
 
     $cfile =~ s/\//\\/g;
     $$cont = "";
-    ReadPPT::ReadPPT($cfile, $cont, $fields);
+    ReadPPT::ReadPPT($cfile, $cont, $fields, $weighted_str);
     $cfile = defined $orig_cfile ? $$orig_cfile : '';
 
     gfilter::line_adjust_filter($cont);
@@ -125,8 +125,8 @@
     return 1;
 }
 
-sub getProperties ($$) {
-    my ($cfile, $fields) = @_;
+sub getProperties ($$$) {
+    my ($cfile, $fields, $weighted_str) = @_;
 
     # See VBA online help using Microsoft PowerPoint in detail.
     # Topic item: 'DocumentProperty Object'.
@@ -150,13 +150,18 @@
 #	unless (defined $date);
 #    $fields->{'date'} = codeconv::shiftjis_to_eucjp($date) if (defined
$date);
 
+    my $keyword = $cfile->BuiltInDocumentProperties('keywords')->{Value};
+    $keyword = codeconv::shiftjis_to_eucjp($keyword);
+    my $weight = $conf::Weight{'metakey'};
+    $$weighted_str .= "\x7f$weight\x7f$keyword\x7f/$weight\x7f\n";
+
     return undef;
 }
 
 package ReadPPT;
 
-sub ReadPPT ($$$) {
-    my ($cfile, $cont, $fields) = @_;
+sub ReadPPT ($$$$) {
+    my ($cfile, $cont, $fields, $weighted_str) = @_;
 
     # Copy From Win32::OLE Example Program
     # use existing instance if PowerPoint is already running
@@ -189,7 +194,7 @@
 	});
     die "Cannot open File $cfile" unless (defined $prs);
 
-    olepowerpoint::getProperties($prs, $fields);
+    olepowerpoint::getProperties($prs, $fields, $weighted_str);
     getSlides($prs, $cont);
 
     $prs->close();
diff -urN namazu.orig/share/namazu/filter/win32/olertf.pl
namazu/share/namazu/filter/win32/olertf.pl
--- namazu.orig/share/namazu/filter/win32/olertf.pl	Sun Dec 30 23:20:42 2001
+++ namazu/share/namazu/filter/win32/olertf.pl	Thu Mar 14 11:41:36 2002
@@ -73,7 +73,7 @@
 
     $cfile =~ s/\//\\/g;
     $$cont = "";
-    ReadMSWord::ReadMSWord($cfile, $cont, $fields);
+    ReadMSWord::ReadMSWord($cfile, $cont, $fields, $weighted_str);
     $cfile = defined $orig_cfile ? $$orig_cfile : '';
 
     gfilter::line_adjust_filter($cont);
diff -urN namazu.orig/share/namazu/filter/win32/oletaro.pl
namazu/share/namazu/filter/win32/oletaro.pl
--- namazu.orig/share/namazu/filter/win32/oletaro.pl	Sun Dec 30 23:20:42 2001
+++ namazu/share/namazu/filter/win32/oletaro.pl	Thu Mar 14 11:42:06 2002
@@ -78,7 +78,7 @@
 
     $cfile =~ s/\//\\/g;
     $$cont = "";
-    ReadMSWord::ReadMSWord($cfile, $cont, $fields);
+    ReadMSWord::ReadMSWord($cfile, $cont, $fields, $weighted_str);
     $cfile = defined $orig_cfile ? $$orig_cfile : '';
 
     gfilter::line_adjust_filter($cont);