Java實現(xiàn)全文檢索-Lucene

1.1. 數(shù)據(jù)分類

結(jié)構(gòu)化數(shù)據(jù):指具有固定格式或有限長度的數(shù)據(jù),如數(shù)據(jù)庫,元數(shù)據(jù)等。
非結(jié)構(gòu)化數(shù)據(jù):指不定長或無固定格式的數(shù)據(jù),如郵件,word文檔等磁盤上的文件

1.2. 非結(jié)構(gòu)化數(shù)據(jù)查詢方法

將非結(jié)構(gòu)化數(shù)據(jù)中的一部分信息提取出來,重新組織,使其變得有一定結(jié)構(gòu),然后對此有一定結(jié)構(gòu)的數(shù)據(jù)進行搜索,從而達到搜索相對較快的目的。這部分從非結(jié)構(gòu)化數(shù)據(jù)中提取出的然后重新組織的信息,我們稱之索引。
例如:字典。字典的拼音表和部首檢字表就相當(dāng)于字典的索引,對每一個字的解釋是非結(jié)構(gòu)化的,如果字典沒有音節(jié)表和部首檢字表,在茫茫辭海中找一個字只能順序掃描。然而字的某些信息可以提取出來進行結(jié)構(gòu)化處理,比如讀音,就比較結(jié)構(gòu)化,分聲母和韻母,分別只有幾種可以一一列舉,于是將讀音拿出來按一定的順序排列,每一項讀音都指向此字的詳細解釋的頁數(shù)。我們搜索時按結(jié)構(gòu)化的拼音搜到讀音,然后按其指向的頁數(shù),便可找到我們的非結(jié)構(gòu)化數(shù)據(jù)——也即對字的解釋。
這種先建立索引,再對索引進行搜索的過程就叫全文檢索(Full-text Search)。
雖然創(chuàng)建索引的過程也是非常耗時的,但是索引一旦創(chuàng)建就可以多次使用,全文檢索主要處理的是查詢,所以耗時間創(chuàng)建索引是值得的。

2.1. 可以使用Lucene實現(xiàn)全文檢索

2.2.1. 獲取原始文檔
Lucene不提供信息采集的類庫,需要自己編寫一個爬蟲程序?qū)崿F(xiàn)信息采集,也可以通過一些開源軟件實現(xiàn)信息采集,如下:

Nutch(http://lucene.apache.org/nutch), Nutch是apache的一個子項目,包括大規(guī)模爬蟲工具,能夠抓取和分辨web網(wǎng)站數(shù)據(jù)。

jsoup(http://jsoup.org/ ),jsoup 是一款Java 的HTML解析器,可直接解析某個URL地址、HTML文本內(nèi)容。它提供了一套非常省力的API,可通過DOM,CSS以及類似于jQuery的操作方法來取出和操作數(shù)據(jù)。

heritrix(http://sourceforge.net/projects/archive-crawler/files/),Heritrix 是一個由 java 開發(fā)的、開源的網(wǎng)絡(luò)爬蟲,用戶可以使用它來從網(wǎng)上抓取想要的資源。其最出色之處在于它良好的可擴展性,方便用戶實現(xiàn)自己的抓取邏輯。

本案例我們要獲取磁盤上文件的內(nèi)容,可以通過文件流來讀取文本文件的內(nèi)容,對于pdf、doc、xls等文件可通過第三方提供的解析工具讀取文件內(nèi)容,比如Apache POI讀取doc和xls的文件內(nèi)容。

2.2.2. 創(chuàng)建文檔對象
在索引前需要將原始內(nèi)容創(chuàng)建成文檔(Document),文檔中包括一個一個的域(Field),域中存儲內(nèi)容。
注意:每個Document可以有多個Field,不同的Document可以有不同的Field,同一個Document可以有相同的Field(域名和域值都相同)
每個文檔都有一個唯一的編號,就是文檔id。

此例子中


ABC.jpg

2.2.3. 分析文檔
需要再對域中的內(nèi)容進行分析,分析的過程是經(jīng)過對原始文檔提取單詞、將字母轉(zhuǎn)為小寫、去除標點符號、去除停用詞等過程生成最終的語匯單元,可以將語匯單元理解為一個一個的單詞。

比如下邊的文檔經(jīng)過分析如下:
原文檔內(nèi)容:
Lucene is a Java full-text search engine. Lucene is not a complete
application, but rather a code library and API that can easily be used
to add search capabilities to applications.
分析后得到的語匯單元:
lucene、java、full、search、engine。。。。

每個單詞叫做一個Term,不同的域中拆分出來的相同的單詞是不同的term。term中包含兩部分一部分是文檔的域名,另一部分是單詞的內(nèi)容。
例如:文件名中包含apache和文件內(nèi)容中包含的apache是不同的term。

2.2.4. 創(chuàng)建索引
對所有文檔分析得出的語匯單元進行索引,索引的目的是為了搜索
注意:創(chuàng)建索引是對語匯單元索引,通過詞語找文檔,這種索引的結(jié)構(gòu)叫倒排索引結(jié)構(gòu)。
傳統(tǒng)方法是根據(jù)文件找到該文件的內(nèi)容,在文件內(nèi)容中匹配搜索關(guān)鍵字,這種方法是順序掃描方法,數(shù)據(jù)量大、搜索慢。

2.2.5. 查詢索引
用戶輸入查詢關(guān)鍵字執(zhí)行搜索之前需要先構(gòu)建一個查詢對象,查詢對象中可以指定查詢要搜索的Field文檔域、查詢關(guān)鍵字等,查詢對象會生成具體的查詢語法,
例如:
語法 “fileName:lucene”表示要搜索Field域的內(nèi)容為“l(fā)ucene”的文檔
搜索過程就是在索引上查找域為fileName,并且關(guān)鍵字為Lucene的term,并根據(jù)term找到文檔id列表。

3.1. Lucene應(yīng)用

3.1.1. 功能一:創(chuàng)建索引庫

3.1.2. Field域的屬性

sadb.jpg

代碼實現(xiàn)


//創(chuàng)建索引
    @Test
    public void createIndex() throws Exception {
        
        //指定索引庫存放的路徑
        //D:\temp\0108\index
        Directory directory = FSDirectory.open(new File("D:\\temp\\0108\\index"));
        //索引庫還可以存放到內(nèi)存中
        //Directory directory = new RAMDirectory();
        //創(chuàng)建一個標準分析器
        Analyzer analyzer = new StandardAnalyzer();
        //創(chuàng)建indexwriterCofig對象
        //第一個參數(shù): Lucene的版本信息,可以選擇對應(yīng)的lucene版本也可以使用LATEST
        //第二根參數(shù):分析器對象
        IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, analyzer);
        //創(chuàng)建indexwriter對象
        IndexWriter indexWriter = new IndexWriter(directory, config);
        //原始文檔的路徑D:\傳智播客\01.課程\04.lucene\01.參考資料\searchsource
        File dir = new File("D:\\傳智播客\\01.課程\\04.lucene\\01.參考資料\\searchsource");
        for (File f : dir.listFiles()) {
            //文件名
            String fileName = f.getName();
            //文件內(nèi)容
            String fileContent = FileUtils.readFileToString(f);
            //文件路徑
            String filePath = f.getPath();
            //文件的大小
            long fileSize  = FileUtils.sizeOf(f);
            //創(chuàng)建文件名域
            //第一個參數(shù):域的名稱
            //第二個參數(shù):域的內(nèi)容
            //第三個參數(shù):是否存儲
            Field fileNameField = new TextField("filename", fileName, Store.YES);
            //文件內(nèi)容域
            Field fileContentField = new TextField("content", fileContent, Store.YES);
            //文件路徑域(不分析、不索引、只存儲)
            Field filePathField = new StoredField("path", filePath);
            //文件大小域
            Field fileSizeField = new LongField("size", fileSize, Store.YES);
            
            //創(chuàng)建document對象
            Document document = new Document();
            document.add(fileNameField);
            document.add(fileContentField);
            document.add(filePathField);
            document.add(fileSizeField);
            //創(chuàng)建索引,并寫入索引庫
            indexWriter.addDocument(document);
        }
        //關(guān)閉indexwriter
        indexWriter.close();
    }


3.2.1. 功能二:查詢索引

sad.jpg

代碼實現(xiàn)


//查詢索引庫
    @Test
    public void searchIndex() throws Exception {
        //指定索引庫存放的路徑
        //D:\temp\0108\index
        Directory directory = FSDirectory.open(new File("D:\\temp\\0108\\index"));
        //創(chuàng)建indexReader對象
        IndexReader indexReader = DirectoryReader.open(directory);
        //創(chuàng)建indexsearcher對象
        IndexSearcher indexSearcher = new IndexSearcher(indexReader);
        //創(chuàng)建查詢
        Query query = new TermQuery(new Term("filename", "apache"));
        //執(zhí)行查詢
        //第一個參數(shù)是查詢對象,第二個參數(shù)是查詢結(jié)果返回的最大值
        TopDocs topDocs = indexSearcher.search(query, 10);
        //查詢結(jié)果的總條數(shù)
        System.out.println("查詢結(jié)果的總條數(shù):"+ topDocs.totalHits);
        //遍歷查詢結(jié)果
        //topDocs.scoreDocs存儲了document對象的id
        for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
            //scoreDoc.doc屬性就是document對象的id
            //根據(jù)document的id找到document對象
            Document document = indexSearcher.doc(scoreDoc.doc);
            System.out.println(document.get("filename"));
            //System.out.println(document.get("content"));
            System.out.println(document.get("path"));
            System.out.println(document.get("size"));
        }
        //關(guān)閉indexreader對象
        indexReader.close();
    }

3.3 功能三:分析器

3.3.1常規(guī)分析器的分詞效果

//查看標準分析器的分詞效果
    public void testTokenStream() throws Exception {
        //創(chuàng)建一個標準分析器對象
        Analyzer analyzer = new StandardAnalyzer();
        //獲得tokenStream對象
        //第一個參數(shù):域名,可以隨便給一個
        //第二個參數(shù):要分析的文本內(nèi)容
        TokenStream tokenStream = analyzer.tokenStream("test", "The Spring Framework provides a comprehensive programming and configuration model.");
        //添加一個引用,可以獲得每個關(guān)鍵詞
        CharTermAttribute charTermAttribute = tokenStream.addAttribute(CharTermAttribute.class);
        //添加一個偏移量的引用,記錄了關(guān)鍵詞的開始位置以及結(jié)束位置
        OffsetAttribute offsetAttribute = tokenStream.addAttribute(OffsetAttribute.class);
        //將指針調(diào)整到列表的頭部
        tokenStream.reset();
        //遍歷關(guān)鍵詞列表,通過incrementToken方法判斷列表是否結(jié)束
        while(tokenStream.incrementToken()) {
            //關(guān)鍵詞的起始位置
            System.out.println("start->" + offsetAttribute.startOffset());
            //取關(guān)鍵詞
            System.out.println(charTermAttribute);
            //結(jié)束位置
            System.out.println("end->" + offsetAttribute.endOffset());
        }
        tokenStream.close();
    }

3.3.2 中文分析器

Lucene自帶中文分詞器
? StandardAnalyzer:
單字分詞:就是按照中文一個字一個字地進行分詞。如:“我愛中國”,
效果:“我”、“愛”、“中”、“國”。
? CJKAnalyzer:
二分法分詞:按兩個字進行切分。如:“我是中國人”,效果:“我是”、“是中”、“中國”“國人”。

上邊兩個分詞器無法滿足需求。
? SmartChineseAnalyzer:
對中文支持較好,但擴展性差,擴展詞庫,禁用詞庫和同義詞庫等不好處理

第三方中文分析器
· paoding: 庖丁解牛最新版在 https://code.google.com/p/paoding/ 中最多支持Lucene 3.0,且最新提交的代碼在 2008-06-03,在svn中最新也是2010年提交,已經(jīng)過時,不予考慮。

· mmseg4j:最新版已從 https://code.google.com/p/mmseg4j/ 移至 https://github.com/chenlb/mmseg4j-solr,支持Lucene 4.10,且在github中最新提交代碼是2014年6月,從09年~14年一共有:18個版本,也就是一年幾乎有3個大小版本,有較大的活躍度,用了mmseg算法。

· IK-analyzer: 最新版在https://code.google.com/p/ik-analyzer/上,支持Lucene 4.10從2006年12月推出1.0版開始, IKAnalyzer已經(jīng)推出了4個大版本。最初,它是以開源項目Luence為應(yīng)用主體的,結(jié)合詞典分詞和文法分析算法的中文分詞組件。從3.0版本開 始,IK發(fā)展為面向Java的公用分詞組件,獨立于Lucene項目,同時提供了對Lucene的默認優(yōu)化實現(xiàn)。在2012版本中,IK實現(xiàn)了簡單的分詞 歧義排除算法,標志著IK分詞器從單純的詞典分詞向模擬語義分詞衍化。 但是也就是2012年12月后沒有在更新。

· ansj_seg:最新版本在 https://github.com/NLPchina/ansj_seg tags僅有1.1版本,從2012年到2014年更新了大小6次,但是作者本人在2014年10月10日說明:“可能我以后沒有精力來維護ansj_seg了”,現(xiàn)在由”nlp_china”管理。2014年11月有更新。并未說明是否支持Lucene,是一個由CRF(條件隨機場)算法所做的分詞算法。

· imdict-chinese-analyzer:最新版在 https://code.google.com/p/imdict-chinese-analyzer/ , 最新更新也在2009年5月,下載源碼,不支持Lucene 4.10 。是利用HMM(隱馬爾科夫鏈)算法。

· Jcseg:最新版本在git.oschina.net/lionsoul/jcseg,支持Lucene 4.10,作者有較高的活躍度。利用mmseg算法。

3.3.3 Analyzer使用時機

  1. 索引時使用Analyzer:對文檔域內(nèi)容進行分析,需要經(jīng)過Analyzer分析器處理生成語匯單元(Token)。
  2. 搜索時使用Analyzer:對搜索關(guān)鍵字進行分析、分詞處理,使用分析后每個詞語進行搜索
    注意:搜索使用的分析器要和索引使用的分析器一致。

3.4 功能四:索引庫的維護

//添加索引
    @Test
    public void addDocument() throws Exception {
        //索引庫存放路徑
        Directory directory = FSDirectory.open(new File("D:\\temp\\0108\\index"));
        
        IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, new IKAnalyzer());
        //創(chuàng)建一個indexwriter對象
        IndexWriter indexWriter = new IndexWriter(directory, config);
        //創(chuàng)建一個Document對象
        Document document = new Document();
        //向document對象中添加域。
        //不同的document可以有不同的域,同一個document可以有相同的域。
        document.add(new TextField("filename", "新添加的文檔", Store.YES));
        document.add(new TextField("content", "新添加的文檔的內(nèi)容", Store.NO));
        document.add(new TextField("content", "新添加的文檔的內(nèi)容第二個content", Store.YES));
        document.add(new TextField("content1", "新添加的文檔的內(nèi)容要能看到", Store.YES));
        //添加文檔到索引庫
        indexWriter.addDocument(document);
        //關(guān)閉indexwriter
        indexWriter.close();
        
    }

3.4.1. 索引庫的添加

//添加索引
    @Test
    public void addDocument() throws Exception {
        //索引庫存放路徑
        Directory directory = FSDirectory.open(new File("D:\\temp\\0108\\index"));
        
        IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, new IKAnalyzer());
        //創(chuàng)建一個indexwriter對象
        IndexWriter indexWriter = new IndexWriter(directory, config);
        //創(chuàng)建一個Document對象
        Document document = new Document();
        //向document對象中添加域。
        //不同的document可以有不同的域,同一個document可以有相同的域。
        document.add(new TextField("filename", "新添加的文檔", Store.YES));
        document.add(new TextField("content", "新添加的文檔的內(nèi)容", Store.NO));
        document.add(new TextField("content", "新添加的文檔的內(nèi)容第二個content", Store.YES));
        document.add(new TextField("content1", "新添加的文檔的內(nèi)容要能看到", Store.YES));
        //添加文檔到索引庫
        indexWriter.addDocument(document);
        //關(guān)閉indexwriter
        indexWriter.close();
        
    }

3.4.3. 索引庫的刪除

  1. 刪除全部
//刪除全部索引
    @Test
    public void deleteAllIndex() throws Exception {
        IndexWriter indexWriter = getIndexWriter();
        //刪除全部索引
        indexWriter.deleteAll();
        //關(guān)閉indexwriter
        indexWriter.close();
    }

  1. 指定查詢條件刪除
//根據(jù)查詢條件刪除索引
    @Test
    public void deleteIndexByQuery() throws Exception {
        IndexWriter indexWriter = getIndexWriter();
        //創(chuàng)建一個查詢條件
        Query query = new TermQuery(new Term("filename", "apache"));
        //根據(jù)查詢條件刪除
        indexWriter.deleteDocuments(query);
        //關(guān)閉indexwriter
        indexWriter.close();
    }

  1. 索引庫的修改
//修改索引庫
    @Test
    public void updateIndex() throws Exception {
        IndexWriter indexWriter = getIndexWriter();
        //創(chuàng)建一個Document對象
        Document document = new Document();
        //向document對象中添加域。
        //不同的document可以有不同的域,同一個document可以有相同的域。
        document.add(new TextField("filename", "要更新的文檔", Store.YES));
        document.add(new TextField("content", "2013年11月18日 - Lucene 簡介 Lucene 是一個基于 Java 的全文信息檢索工具包,它不是一個完整的搜索應(yīng)用程序,而是為你的應(yīng)用程序提供索引和搜索功能。", Store.YES));
        indexWriter.updateDocument(new Term("content", "java"), document);
        //關(guān)閉indexWriter
        indexWriter.close();
    }

3.5.1 Lucene索引庫查詢

可通過兩種方法創(chuàng)建查詢對象:
1)使用Lucene提供Query子類
Query是一個抽象類,lucene提供了很多查詢對象,比如TermQuery項精確查詢,NumericRangeQuery數(shù)字范圍查詢等。
如下代碼:
Query query = new TermQuery(new Term("name", "lucene"));
2)使用QueryParse解析查詢表達式
QueryParse會將用戶輸入的查詢表達式解析成Query對象實例。
如下代碼:
QueryParser queryParser = new QueryParser("name", new IKAnalyzer());
Query query = queryParser.parse("name:lucene");

3.5.2. 使用query的子類查詢
①MatchAllDocsQuery

使用MatchAllDocsQuery查詢索引目錄中的所有文檔

@Test
    public void testMatchAllDocsQuery() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //創(chuàng)建查詢條件
        Query query = new MatchAllDocsQuery();
        //執(zhí)行查詢
        printResult(query, indexSearcher);
    }

②TermQuery

TermQuery,通過項查詢,TermQuery不使用分析器所以建議匹配不分詞的Field域查詢,比如訂單號、分類ID號等。
指定要查詢的域和要查詢的關(guān)鍵詞。

//使用Termquery查詢
    @Test
    public void testTermQuery() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //創(chuàng)建查詢對象
        Query query = new TermQuery(new Term("content", "lucene"));
        //執(zhí)行查詢
        TopDocs topDocs = indexSearcher.search(query, 10);
        //共查詢到的document個數(shù)
        System.out.println("查詢結(jié)果總數(shù)量:" + topDocs.totalHits);
        //遍歷查詢結(jié)果
        for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
            Document document = indexSearcher.doc(scoreDoc.doc);
            System.out.println(document.get("filename"));
            //System.out.println(document.get("content"));
            System.out.println(document.get("path"));
            System.out.println(document.get("size"));
        }
        //關(guān)閉indexreader
        indexSearcher.getIndexReader().close();
    }

③NumericRangeQuery

可以根據(jù)數(shù)值范圍查詢。

//數(shù)值范圍查詢
    @Test
    public void testNumericRangeQuery() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //創(chuàng)建查詢
        //參數(shù):
        //1.域名
        //2.最小值
        //3.最大值
        //4.是否包含最小值
        //5.是否包含最大值
        Query query = NumericRangeQuery.newLongRange("size", 1l, 1000l, true, true);
        //執(zhí)行查詢
        printResult(query, indexSearcher);
    }

④BooleanQuery
可以組合查詢條件。

//組合條件查詢
    @Test
    public void testBooleanQuery() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //創(chuàng)建一個布爾查詢對象
        BooleanQuery query = new BooleanQuery();
        //創(chuàng)建第一個查詢條件
        Query query1 = new TermQuery(new Term("filename", "apache"));
        Query query2 = new TermQuery(new Term("content", "apache"));
        //組合查詢條件
        query.add(query1, Occur.MUST);
        query.add(query2, Occur.MUST);
        //執(zhí)行查詢
        printResult(query, indexSearcher);
    }
//Occur.MUST:必須滿足此條件,相當(dāng)于and
//Occur.SHOULD:應(yīng)該滿足,但是不滿足也可以,相當(dāng)于or
//Occur.MUST_NOT:必須不滿足。相當(dāng)于not

3.5.3. 使用queryparser查詢
通過QueryParser也可以創(chuàng)建Query,QueryParser提供一個Parse方法,此方法可以直接根據(jù)查詢語法來查詢。Query對象執(zhí)行的查詢語法可通過System.out.println(query);查詢。
需要使用到分析器。建議創(chuàng)建索引時使用的分析器和查詢索引時使用的分析器要一致。

程序?qū)崿F(xiàn)

@Test
    public void testQueryParser() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //創(chuàng)建queryparser對象
        //第一個參數(shù)默認搜索的域
        //第二個參數(shù)就是分析器對象
        QueryParser queryParser = new QueryParser("content", new IKAnalyzer());
        Query query = queryParser.parse("Lucene是java開發(fā)的");
        //執(zhí)行查詢
        printResult(query, indexSearcher);
    }

查詢語法
1、基礎(chǔ)的查詢語法,關(guān)鍵詞查詢:

域名+“:”+搜索的關(guān)鍵字

例如:content:java

2、范圍查詢

域名+“:”+[最小值 TO 最大值]

例如:size:[1 TO 1000]

范圍查詢在lucene中支持數(shù)值類型,不支持字符串類型。在solr中支持字符串類型。

3、組合條件查詢

1)+條件1 +條件2:兩個條件之間是并且的關(guān)系and

例如:+filename:apache +content:apache

2)+條件1 條件2:必須滿足第一個條件,應(yīng)該滿足第二個條件

例如:+filename:apache content:apache

3)條件1 條件2:兩個條件滿足其一即可。

例如:filename:apache content:apache

4)-條件1 條件2:必須不滿足條件1,要滿足條件2

例如:-filename:apache content:apache

Occur.MUST 查詢條件必須滿足,相當(dāng)于and → +(加號)
Occur.SHOULD 查詢條件可選,相當(dāng)于or → 空(不用符號)
Occur.MUST_NOT 查詢條件不能滿足,相當(dāng)于not非 → -(減號)

第二種寫法:

條件1 AND 條件2

條件1 OR 條件2

條件1 NOT 條件2

MultiFieldQueryParser
可以指定多個默認搜索域

@Test
    public void testMultiFiledQueryParser() throws Exception {
        IndexSearcher indexSearcher = getIndexSearcher();
        //可以指定默認搜索的域是多個
        String[] fields = {"filename", "content"};
        //創(chuàng)建一個MulitFiledQueryParser對象
        MultiFieldQueryParser queryParser = new MultiFieldQueryParser(fields, new IKAnalyzer());
        Query query = queryParser.parse("java AND apache");
        System.out.println(query);
        //執(zhí)行查詢
        printResult(query, indexSearcher);
        
    }

e.g. 本文僅供個人筆記使用,借鑒部分網(wǎng)上資料。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1. 案例分析:什么時全文檢索,如何實現(xiàn)全文檢索 ? 1.1 案例 ? 實現(xiàn)一個文件的搜索功能,通過關(guān)鍵字搜索文件...
    東方舵手閱讀 1,230評論 0 1
  • 目錄結(jié)構(gòu):1.全文檢索 2.Lucene入門3.Lucene進階 全文檢索 一, 生活中的搜索:1.Win...
    CoderZS閱讀 1,799評論 0 12
  • 1. Lucene 官網(wǎng) 1). 概述 Lucene是一款高性能的、可擴展的信息檢索(IR)工具庫。信息檢索是指文...
    _凌浩雨閱讀 1,008評論 0 1
  • 也是項目需要用的框架之一,為了不讓自己輕易忘記它,在此記錄一系列的lucene學(xué)習(xí)筆記(基于lucene4.4,I...
    JackFrost_fuzhu閱讀 2,090評論 4 27
  • (五) 林落珩離開的日子,像是一張永遠不上色的空白的紙,它堅強,是因為它永遠保持干凈,它脆弱,是因為它只能是紙,擁...
    藜遠閱讀 396評論 0 3

友情鏈接更多精彩內(nèi)容