|
|
@ -44,7 +44,7 @@ import java.util.List; |
|
|
|
* Created by XiaXiang on 2018/1/22. |
|
|
|
* Created by XiaXiang on 2018/1/22. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
private static final int MAX_SIZE = 3; |
|
|
|
private static final int MAX_SIZE = 100; |
|
|
|
private static RecentSearchManager instance; |
|
|
|
private static RecentSearchManager instance; |
|
|
|
IndexReader indexReader = null; |
|
|
|
IndexReader indexReader = null; |
|
|
|
IndexSearcher indexSearcher = null; |
|
|
|
IndexSearcher indexSearcher = null; |
|
|
@ -174,7 +174,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
String searchField = "searchKey"; |
|
|
|
String searchField = "searchKey"; |
|
|
|
Term term = new Term(searchField, key); |
|
|
|
Term term = new Term(searchField, key); |
|
|
|
Query query = new TermQuery(term); |
|
|
|
Query query = new TermQuery(term); |
|
|
|
TopFieldDocs docs = searcher.search(query, 100, sortKey); |
|
|
|
TopFieldDocs docs = searcher.search(query, MAX_SIZE, sortKey); |
|
|
|
ScoreDoc[] scores = docs.scoreDocs; |
|
|
|
ScoreDoc[] scores = docs.scoreDocs; |
|
|
|
this.recentModelList = new SearchResult(); |
|
|
|
this.recentModelList = new SearchResult(); |
|
|
|
//遍历结果
|
|
|
|
//遍历结果
|
|
|
|