LoginSignup
5
10

More than 5 years have passed since last update.

HyperEstraierを動かしてみる

Last updated at Posted at 2018-04-30

HyperEstraierの動作確認をしてみます。

◆前提

構築するのは次の環境

OS Windows8.1

◆HyperEstraierのインストール

サイトからD/Lして配置する

対象バージョン HyperEstraier 1.4.13
D/Lサイト http://d.hatena.ne.jp/aenomoto/touch/searchdiary?word=%2A%5BHyperEstraier%5D

ここの「私のビルドしたバージョン1.4.13も置いておきます*2。」から

◆ユーザーガイド

◆動作検証01

次に、テキストファイルの全文検索を確認してみます。

0.前提

[hyperEstraier *1] インストール先フォルダ
[hyperEstraierDir *2] DBインデックス対象のファイル格納フォルダのある親フォルダ

1.検索対象のファイルを作成(テキスト形式ファイル)

est_001.txt
Hello hogehoge!
apple, angle and ant.
est_002.txt
Hello hogehoge!
bear big book.あいうえお
est_003.txt
Hello hogehoge!
city, crime and creation.

上記ファイルを blue, red, yellowのフォルダにそれぞれコピーします。
(次のようなフォルダ、ファイル配置を想定しています)

[hyperEstraierDir *2]\est
├─blue
│      est_001.txt
│      est_002.txt
│      est_003.txt
│
├─red
│      est_001.txt
│      est_002.txt
│      est_003.txt
│
└─yellow
        est_001.txt
        est_002.txt
        est_003.txt

2.DBインデックス構築スクリプト作成

次のbatファイルを作成し、DBインデックスフォルダを作成するフォルダ([hyperEstraierDir *2]に同じ)に保存します。

estcmd-rebuild.bat
@echo off
@rem ===============================================
@rem estcmd インデックス(再)構築
@rem ===============================================

@rem estcmdコマンドフルパス
set estcmd="[hyperEstraier *1]\bin\estcmd"

@rem 文字コード指定
set sp_enc=CP932

@rem 言語指定
set sp_lang=ja

@rem コマンドオプション
set opt_gather_1=gather -tr -cl -ws -ft -ic
set opt_gather_2=-il
set opt_gather_3=-sd -pc
set opt_gather_4=-aa @genre bunrui1

@rem インデックス指定
set db_name=casket_test

@rem インデックスルートフォルダ指定
set db_dir="[hyperEstraierDir *2]\est"

@echo on
@rem estcmd コマンド実行
%estcmd% %opt_gather_1% %sp_enc% %opt_gather_2% %sp_lang% %opt_gather_3% %sp_enc% %opt_gather_4% %db_name% %db_dir%

@echo off
pause

3.検索実施スクリプト作成

検索条件について

  • 属性による抽出条件は属性「uri」に「yellow」を含むもの
  • キーワードは、「あいうえお」
estcmd-search.bat
@echo off
@rem ===============================================
@rem estcmd インデックス検索(任意文字列指定)
@rem ===============================================

@rem estcmdコマンドフルパス
set estcmd="[hyperEstraier *1]\bin\estcmd"

@rem 文字コード指定
set sp_enc=CP932

@rem コマンドオプション
set opt_srch_1=search -nl -ic
set opt_srch_2=-vh -hs
set opt_srch_3=-attr
set opt_iconv_1=iconv -oc
@rem インデックス指定
set db_name=casket_test

@rem 検索条件
set cond_attr="@uri STRINC yellow"
set cond_phrase="あいうえお"

@echo on
@rem estcmd コマンド実行
%estcmd% %opt_srch_1% %sp_enc% %opt_srch_2% %opt_srch_3% %cond_attr% %db_name% %cond_phrase% | %estcmd% %opt_iconv_1% %sp_enc%

@echo off
pause

4.スクリプトを実行

estcmd-rebuild.bat

カレントフォルダにインデックス「casket_test」が作成されます。

estcmd-search.bat

--------[02D18ACF56D24348]--------
VERSION 1.0
NODE    local
HIT     1
HINT#1  あいうえお      1
TIME    0.000000
DOCNUM  10
WORDNUM 75
VIEW    HUMAN

--------[02D18ACF56D24348]--------

Score: 9414
URI: file:///[hyperEstraierDir *2]/est/yellow/est_002.txt
Title: est_002.txt

Hello hogehoge! bear big book.あいうえお ...


--------[02D18ACF56D24348]--------:END
続行するには何かキーを押してください . . .

このように、テキストファイルの全文検索はできました!!
(yellowフォルダ下のest_002.txtにヒットしました!)

◆動作検証02

次に、テキストファイル以外のファイル(MSO、PDF等)の検索もできるようにしてみます。

1.検索対象のファイルを作成(テキスト形式ファイル、MSO形式ファイル、PDF形式ファイル)

est_002.txt
Hello hogehoge!
bear big book.あいうえお
est_001.docx, est_003.doc
001docx.png
est_004.xlsx, est_005.xls
004xlsx_s1.png
004xlsx_s2.png
004xlsx_s3.png
est_006.pptx, est_007.ppt
006pptx.png
est_008.pdf
008pdf.png
[hyperEstraierDir *2]\est
├─blue
│      est_001.docx
│      est_002.txt
│      est_003.doc
│      est_004.xlsx
│      est_005.xls
│      est_006.pptx
│      est_007.ppt
│      est_008.pdf
│
├─red
│      est_001.docx
│      est_002.txt
│      est_003.doc
│      est_004.xlsx
│      est_005.xls
│      est_006.pptx
│      est_007.ppt
│      est_008.pdf
│
└─yellow
       est_001.docx
       est_002.txt
       est_003.doc
       est_004.xlsx
       est_005.xls
       est_006.pptx
       est_007.ppt
       est_008.pdf

2.DBインデックス構築スクリプト作成

同報されているフィルタ(estxfilt.bat)を次の場所に配置(コピー)し、修正します。
配置場所:[hyperEstraier *1]\bin\

estxfilt.bat
@echo off
set xdoc2txt="[hyperEstraier *1]\bin\xdoc2txt"
%xdoc2txt% -s -r=0 -o=0 %1 > %2

インデックス構築のスクリプト(batファイル)を修正します。

estcmd-rebuild.bat
@echo off
@rem ===============================================
@rem estcmd インデックス(再)構築
@rem ===============================================

@rem estcmdコマンドフルパス
set estcmd="[hyperEstraier *1]\bin\estcmd"
set estxfilt="[hyperEstraier *1]\bin\estxfilt"

@rem 文字コード指定
set sp_enc=CP932

@rem 言語指定
set sp_lang=ja

@rem ファイル形式
set ext_bn=.txt,.pdf,.doc,.xls,.ppt,.docx,.xlsx,.pptx

@rem コマンドオプション
set opt_gather_0=gather
set opt_gather_1=-fx
set opt_gather_2=-fz -ic
set opt_gather_3=-il
set opt_gather_4=-sd -pc
set opt_gather_5=-tr -cl -ws -aa @genre bunrui1

@rem インデックス指定
set db_name=casket_test

@rem インデックスルートフォルダ指定
set db_dir="[hyperEstraierDir *2]\est"

@echo on
@rem estcmd コマンド実行
%estcmd% %opt_gather_0% %opt_gather_1% %ext_bn%  T@%estxfilt% %opt_gather_2% %sp_enc% %opt_gather_3% %sp_lang% %opt_gather_4% %sp_enc% %opt_gather_5% %db_name% %db_dir%

@echo off
pause

3.検索実施スクリプト作成

 ⇒前回作成したスクリプトに修正はありません。そのまま使用します。

4.スクリプトを実行

  • 既に作成されているインデックス「casket_test」を削除します。
  • 修正したDBインデックス構築スクリプトを実行し、インデックスを再作成します。
estcmd-rebuild.bat
  • カレントフォルダにインデックス「casket_test」が作成されます。
estcmd-search.bat

--------[02D18ACF6CA525A7]--------
VERSION 1.0
NODE    local
HIT     8
HINT#1  あいうえお      24
TIME    0.000000
DOCNUM  25
WORDNUM 57
VIEW    HUMAN

--------[02D18ACF6CA525A7]--------

Score: 13844
URI: file:///[hyperEstraierDir *2]/est/yellow/est_004.xlsx
Title: est_004.xlsx

[Sheet1] Hello hogehoge! bear big book.あいうえお [sheet002] Hello hogehoge! bear big book.あいうえお ... えお [シート003] Hello hogehoge! bear big boo
k.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 13844
URI: file:///[hyperEstraierDir *2]/est/yellow/est_005.xls
Title: est_005.xls

[Sheet1] Hello hogehoge! bear big book.あいうえお [sheet002] Hello hogehoge! bear big book.あいうえお ... えお [シート003] Hello hogehoge! bear big boo
k.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 7906
URI: file:///[hyperEstraierDir *2]/est/yellow/est_006.pptx
Title: est_006.pptx

[Page1] Hello hogehoge ! bear big book. あいうえ お ...


--------[02D18ACF6CA525A7]--------

Score: 7906
URI: file:///[hyperEstraierDir *2]/est/yellow/est_001.docx
Title: est_001.docx

Hello hogehoge! bear big book.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 7906
URI: file:///[hyperEstraierDir *2]/est/yellow/est_002.txt
Title: est_002.txt

Hello hogehoge! bear big book.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 7906
URI: file:///[hyperEstraierDir *2]/est/yellow/est_003.doc
Title: est_003.doc

Hello hogehoge! bear big book.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 7906
URI: file:///[hyperEstraierDir *2]/est/yellow/est_008.pdf
Title: est_008.pdf

Hello hogehoge! bear big book.あいうえお ...


--------[02D18ACF6CA525A7]--------

Score: 7406
URI: file:///[hyperEstraierDir *2]/est/yellow/est_007.ppt
Title: est_007.ppt

マスター タイトルの書式設定 マスター テキストの書式設定 第 2 レベル 第 3 レベル 第 4 レベル 第 5 ...  レベル * * Hello hogehoge! bear big book.あいうえ
お ...


--------[02D18ACF6CA525A7]--------:END
続行するには何かキーを押してください . . .

このように、テキストファイルだけでなくMSOファイル、PDFファイルについても全文検索はできました!!

5
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
10