最近學(xué)校課程在做搜索引擎相關(guān)研究,在數(shù)據(jù)構(gòu)建索引方面老師推薦了Luke.于是利用周末的時間,快速品嘗一下Luke.
目錄
1.Luke簡介
2.Luke下載/安裝
3.Luke使用
--3.1打開Luke/索引信息初始化
--3.2體驗Luke功能
-----3.2.1索引文件查看
-----3.2.2索引文件操作
-----3.2.3索引插件管理
4.總結(jié)
1.Luke簡介(摘自Luke/GitHub)
Luke在GitHub的地址:
Luke is the GUI tool for introspecting your Lucene / Solr / Elasticsearch index. It allows:
- Viewing your documents and analyzing their field contents (for stored fields)
- Searching in the index
- Performing index maintenance: index health checking, index optimization (take a backup before running this!)
- Reading index from hdfs
- Exporting the index or portion of it into an xml format
- Testing your custom Lucene analyzers
- Creating your own plugins!
Search engines luke can deal with
Search engines luke can deal with:
- Apache Lucene. Most certainly luke can open lucene index produced by pure Lucene. Do people make pure Lucene these days?
- Apache Solr. Solr and Lucene share the same code base, so it is natural that luke can open Lucene Index produced by Solr.
- Elasticsearch. Elasticsearch uses Lucene as its lowest-level search engine base. So luke can open its index too!
我們的搜索引擎項目是基于solr進行的,Luke可以配合solr進行更多更好更方便的開發(fā)工作,看來老師推薦Luke是有道理的!
2.Luke下載/安裝
下載和安裝也是順其自然的事
下載當然是在github的luke官網(wǎng):
不同的Lucene版本要對應(yīng)其相對應(yīng)的Luke版本,所以在下載Luke的時候要選擇合適于自己所安裝的Lucene的版本.這里我們選擇最新版
6.5.0
安裝在指引文檔中也有說明:
1.Clone the repository.
2.Runmvn install
from the project directory. (Make sure you have Java and Maven installed before doing this)
3.Use luke.sh or luke.bat for launching luke from the command line based on the OS you are in.
簡單的來說,下載與安裝只需要在GitHub上克隆Luke到本地,然后雙擊luke.sh
或 luke.bat
啟動即可.
3.Luke使用
3.1打開Luke/索引信息初始化
在Windows系統(tǒng)下,我們通過雙擊 luke.bat
打開Luke的可視化界面:
系統(tǒng)提示我們寫入我們索引的路徑.我們可以直接寫入之前索引存放的路徑,也可以在luke目錄下面新建一個文件夾,將之前的索引文件復(fù)制過來.由于我們的項目是跑在服務(wù)器上的,所以為了方便我們將服務(wù)器上生成的索引文件復(fù)制一份到我們寫入的路徑中去.
注意:如果路徑中沒有索引文件的話會報錯:
啟動成功!
3.2體驗Luke功能
索引文件查看
在luke中,我們能夠很方便的查看索引的數(shù)量,索引的fields等索引的總體信息,也能夠細致入微的查看當前索引中某一個item的具體信息,包括某一個字段的屬性/內(nèi)容/大小等等.
在
overview
選項卡中,我們能夠看到index name
,number of fields
,number of terms
等總體信息也能看到所有的
fields
信息,包括其name,term count,decoder
等等信息當然了,我們也能看到索引出來的信息,包括
rank,field
等等.
在Documents
選項卡中,我們也能在選項卡下方看到具體的每一個item所包含的所有fields信息,我們也能點開下方的Show
按鈕查看某一個field的具體信息
索引文件操作
在Luke中我們也能對索引的items進行操作,包括增/刪/查/改
操作
add
為增
操作,
reconstruct & edit
為改
操作
delete
為刪
操作
browse by term
為'查'操作,當然了在search
選項卡中有更為具體的查
操作
當然了,至于具體的按鈕是怎么操作的我們在這里按住不表,有興趣的同學(xué)自行去嘗試一下~
索引插件管理
在plugins
選項卡里面,我們能夠看到若干個Luke自帶的插件
簡單介紹一下這幾款自帶的插件:
- Analyzer Tool : 分詞器工具,可以選擇分詞器并對分詞器分詞的效果進行展示
- Hadoop Plugin: 支持對Hadoop任何文件系統(tǒng)的索引
- Scripting Luke: 提供了一個JavaScript的交互式Shell
- Custom Similarity: 設(shè)計自定義相似性的插件
- Vocabulary Analysisi Tool: 一個表示索引詞匯增長的工具
- Zipf distribution:顯示術(shù)語流行度發(fā)行的工具
4.總結(jié)
luke對于solr來說毫無疑問是對其索引功能的豐富.雖然solr有一個自帶的web管理頁面,但是作為擴展其索引功能的工具Luke,搭配solr我們能夠更方便的實現(xiàn)索引的相關(guān)操作.
通過luke,我們能夠簡單直接的查看索引的具體信息;我們也能夠在luke上直接對其索引內(nèi)容進行相關(guān)操作;當然了,luke提供了強大的可擴展性功能,能夠讓我們用戶能夠擁有自定義的個性化需求.最重要的是,我們能夠通過luke對索引的語句進行檢驗,分析查詢效率,對查詢進行優(yōu)化,這顯然能夠幫助我們構(gòu)建更好更優(yōu)秀的搜索引擎.
相關(guān)推薦
Solr6.5.1環(huán)境搭建+相關(guān)命令+索引查詢