use of com.rbmhtechnology.vind.SearchServerException in project vind by RBMHTechnology.
the class SolrSearchServer method clearIndex.
@Override
public void clearIndex() {
try {
solrClientLogger.debug(">>> clear complete index");
solrClient.deleteByQuery("*:*");
} catch (SolrServerException | IOException e) {
log.error("Cannot clear index", e);
throw new SearchServerException("Cannot clear index", e);
}
}
use of com.rbmhtechnology.vind.SearchServerException in project vind by RBMHTechnology.
the class SolrSearchServer method execute.
@Override
public SearchResult execute(FulltextSearch search, DocumentFactory factory) {
final SolrQuery query = buildSolrQuery(search, factory);
// query
try {
solrClientLogger.debug(">>> query({})", query.toString());
final QueryResponse response = solrClient.query(query, SolrRequest.METHOD.POST);
if (response != null) {
final Map<String, Integer> childCounts = SolrUtils.getChildCounts(response);
final List<Document> documents = SolrUtils.Result.buildResultList(response.getResults(), childCounts, factory, search.getSearchContext());
final FacetResults facetResults = SolrUtils.Result.buildFacetResult(response, factory, search.getChildrenFactory(), search.getFacets(), search.getSearchContext());
switch(search.getResultSet().getType()) {
case page:
{
return new PageResult(response.getResults().getNumFound(), response.getQTime(), documents, search, facetResults, this, factory).setElapsedTime(response.getElapsedTime());
}
case slice:
{
return new SliceResult(response.getResults().getNumFound(), response.getQTime(), documents, search, facetResults, this, factory).setElapsedTime(response.getElapsedTime());
}
default:
return new PageResult(response.getResults().getNumFound(), response.getQTime(), documents, search, facetResults, this, factory).setElapsedTime(response.getElapsedTime());
}
} else {
throw new SolrServerException("Null result from SolrClient");
}
} catch (SolrServerException | IOException e) {
throw new SearchServerException("Cannot issue query", e);
}
}
use of com.rbmhtechnology.vind.SearchServerException in project vind by RBMHTechnology.
the class SolrSearchServer method execute.
@Override
public SuggestionResult execute(ExecutableSuggestionSearch search, DocumentFactory assets, DocumentFactory childFactory) {
SolrQuery query = buildSolrQuery(search, assets, childFactory);
try {
log.debug(">>> query({})", query.toString());
QueryResponse response = solrClient.query(query, SolrRequest.METHOD.POST);
if (response != null) {
return SolrUtils.Result.buildSuggestionResult(response, assets, childFactory, search.getSearchContext());
} else {
log.error("Null result from SolrClient");
throw new SolrServerException("Null result from SolrClient");
}
} catch (SolrServerException | IOException e) {
log.error("Cannot execute suggestion query");
throw new SearchServerException("Cannot execute suggestion query", e);
}
}
use of com.rbmhtechnology.vind.SearchServerException in project vind by RBMHTechnology.
the class SolrSearchServer method execute.
@Override
public GetResult execute(RealTimeGet search, DocumentFactory assets) {
SolrQuery query = buildSolrQuery(search, assets);
try {
log.debug(">>> query({})", query.toString());
QueryResponse response = solrClient.query(query, SolrRequest.METHOD.POST);
if (response != null) {
return SolrUtils.Result.buildRealTimeGetResult(response, search, assets);
} else {
log.error("Null result from SolrClient");
throw new SolrServerException("Null result from SolrClient");
}
} catch (SolrServerException | IOException e) {
log.error("Cannot execute realTime get query");
throw new SearchServerException("Cannot execute realTime get query", e);
}
}
Aggregations