public SearchInfo getSearch(String siteId, String query, int pageSize, int pageNavCount, int pageNum) throws Exception {
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
Indexer indexer = Indexer.getInstance(siteId);
QueryResult queryResult = indexer.search(query,
contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getSiteProfileClassId(),
siteDomain.getSiteDomainId(),
pageNum,
pageSize);
SearchInfo info = new SearchInfo();
info.setQuery(query);
info.setHitsCount(queryResult.getHitCount());
int recordCount = queryResult.getHitCount();
int pageTotal = recordCount / pageSize;
if (recordCount % pageSize > 0) {
pageTotal++;
}
info.setPageTotal(pageTotal);
info.setPageNum(pageNum);
int pageStart = pageNum - pageNavCount / 2;
if (pageStart < 1) {
pageStart = 1;
}
int pageEnd = pageNum + (pageNavCount + 1) / 2;
if (pageEnd > pageTotal) {
pageEnd = pageTotal;
}
info.setPageStart(pageStart);
info.setPageEnd(pageEnd);
Vector<DataInfo> vector = new Vector<DataInfo>();
Vector<?> queryHits = queryResult.getQueryHits();
Iterator<?> iterator = queryHits.iterator();
while (iterator.hasNext()) {
Object object = iterator.next();
if (object instanceof CompassContentLanguage) {
CompassContentLanguage compassContentLanguage = (CompassContentLanguage) object;