Lucene的查詢及高階內容

2021-09-08 09:03:46 字數 1373 閱讀 4500

基本查詢:

@test

public

void basequery() throws

exception

}

多樣化查詢:

//

提取乙個查詢的方法

public

void query(query query) throws

exception

}//詞條查詢

@test

public

void termquery() throws

exception

//萬用字元查詢

@test

public

void wildcardquery() throws

exception

//模糊查詢

@test

public

void fuzzquery() throws

exception

//數值範圍查詢

@test

public

void numericrangequery() throws

exception

//組合查詢

@test

public

void testbooleanquery() throws

exception

高亮:

//

高亮顯示

@test

public

void testhighlighter() throws

exception

}

排序:

//

排序@test

public

void testsortquery() throws

exception

}

分頁:

@test

public

void testpagequery() throws

exception

}

加權因子:

textfield textfield = new textfield("content","lucene加權因子", store.yes);

textfield.setboost(10);

posted @

2017-11-06 11:49

青衫仗劍 閱讀(

...)

編輯收藏

Lucene高階高階之模糊查詢

模板 lucene支援相似查詢,在英文單詞中,roam與foam roams等詞非常相似,所謂相似查詢就是當我們查roam的時候,包含foam及roams的文件也會被包括到查詢結構中。相似查詢在關鍵字後面使用 波浪線 符號,後面可以跟乙個表示相似度的數字,比如 0.85,0.3,1,值在0 1之間,...

Lucene高階 and 和or的條件查詢

param type,資源的型別,其值為news或product param searchkey,搜尋的關鍵字 return hits public hits executesearch string type,string keyword 同時宣告乙個與之對應的字段陣列 string fields...

Lucene 排序及多字段查詢

預設情況下,indexsearcher類的search方法返回查詢結果時,是按文件的分值排序的,可以使用過載的search方法對結果排序 indexsearcher.search query,sort new sort 和 sort.relevance,以及null一樣,採用預設排序,要定義排序字段...