flathill
はじめまして、平岡と申します。
docsearchプラグインでPDF, txtファイル中の文字列を検索する際に、ファイル名が日本語(UTF-8)の場合に
検索結果に入りませんでしたので、パッチを作成してみました。
問題等お気づきの点がありましたら、コメントを頂けますと助かります。
- Dokuwikiバージョン
2014-09-29a "Hrun"
- Docsearchプラグインバージョン
date 2013-08-14
- パッチ
# cat inc_indexer.php.patch
--- inc/indexer.php.ORG 2014-10-08 16:59:23.000000000 +0900
+++ inc/indexer.php 2014-12-10 21:16:27.843433781 +0900
@@ -1318,7 +1318,7 @@
function idx_addPage($page, $verbose=false, $force=false) {
$idxtag = metaFN($page,'.indexed');
// check if page was deleted but is still in the index
- if (!page_exists($page)) {
+ if (!page_exists($page,'',false)) {
if (!@file_exists($idxtag)) {
if ($verbose) print("Indexer: $page does not exist, ignoring".DOKU_LF);
return false;
@@ -1386,7 +1386,7 @@
unset($evt);
extract($data);
- $result = $Indexer->addPageWords($page, $body);
+ $result = $Indexer->addPageWords(urldecode ($page), $body);
if ($result === "locked") {
if ($verbose) print("Indexer: locked".DOKU_LF);
return false;
# cat lib_plugins_docsearch_conf_converter.php.patch
--- lib/plugins/docsearch/conf/converter.php.dist 2014-07-15 03:13:06.000000000 +0900
+++ lib/plugins/docsearch/conf/converter.php 2014-12-10 21:47:21.308464925 +0900
@@ -13,5 +13,5 @@
#
# example
#
-#pdf /usr/bin/pdftotext %in% %out%
-#doc /usr/bin/antiword %in% > %out%
+pdf /usr/bin/pdftotext -enc UTF-8 %in% %out%
+txt /bin/cat %in% | /usr/bin/nkf -w > %out%
# cat lib_plugins_docsearch_cron.php.patch
--- lib/plugins/docsearch/cron.php.ORG 2014-07-15 03:13:06.000000000 +0900
+++ lib/plugins/docsearch/cron.php 2014-12-10 21:40:21.983429730 +0900
@@ -100,7 +100,7 @@
// add the page to the index
$ID = cleanID($id);
- idx_addPage($ID);
+ idx_addPage($id);
}
/**