...
|
...
|
@@ -65,28 +65,6 @@ public class SearchCommonService implements ApplicationEventPublisherAware { |
|
|
* 通用的查询接口
|
|
|
*
|
|
|
* @param indexName
|
|
|
* @param searchParam
|
|
|
* @return
|
|
|
*/
|
|
|
public SearchResult doSearch(final String indexName, final SearchParam searchParam) {
|
|
|
long begin = System.currentTimeMillis();
|
|
|
performanceMonitor.addVisitCount();
|
|
|
try {
|
|
|
IElasticsearchClient client = elasticsearchClientFactory.getClient(indexName);
|
|
|
SearchResult searchResult = client.search(indexName, indexName, searchParam);
|
|
|
this.publishSearchResultEvent(indexName, searchParam, searchResult);
|
|
|
return searchResult;
|
|
|
} catch (Exception e) {
|
|
|
throw e;
|
|
|
}finally{
|
|
|
performanceMonitor.addCost(System.currentTimeMillis() - begin);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通用的查询接口
|
|
|
*
|
|
|
* @param indexName
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
...
|
...
|
@@ -141,6 +119,28 @@ public class SearchCommonService implements ApplicationEventPublisherAware { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通用的查询接口
|
|
|
*
|
|
|
* @param indexName
|
|
|
* @param searchParam
|
|
|
* @return
|
|
|
*/
|
|
|
public SearchResult doSearch(final String indexName, final SearchParam searchParam) {
|
|
|
long begin = System.currentTimeMillis();
|
|
|
performanceMonitor.addVisitCount();
|
|
|
try {
|
|
|
IElasticsearchClient client = elasticsearchClientFactory.getClient(indexName);
|
|
|
SearchResult searchResult = client.search(indexName, indexName, searchParam);
|
|
|
this.publishSearchResultEvent(indexName, searchParam, searchResult);
|
|
|
return searchResult;
|
|
|
} catch (Exception e) {
|
|
|
throw e;
|
|
|
}finally{
|
|
|
performanceMonitor.addCost(System.currentTimeMillis() - begin);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通过id获取内容
|
|
|
*
|
|
|
* @param indexName
|
...
|
...
|
|