Author: manaRH
Date: 2011-01-18 15:20:12 -0500 (Tue, 18 Jan 2011)
New Revision: 14000
Modified:
branches/community/Seam_2_2/examples/dvdstore/jboss6/src/com/jboss/dvd/seam/FullTextSearchAction.java
Log:
JBSEAM-4765
Modified:
branches/community/Seam_2_2/examples/dvdstore/jboss6/src/com/jboss/dvd/seam/FullTextSearchAction.java
===================================================================
---
branches/community/Seam_2_2/examples/dvdstore/jboss6/src/com/jboss/dvd/seam/FullTextSearchAction.java 2011-01-18
14:13:56 UTC (rev 13999)
+++
branches/community/Seam_2_2/examples/dvdstore/jboss6/src/com/jboss/dvd/seam/FullTextSearchAction.java 2011-01-18
20:20:12 UTC (rev 14000)
@@ -135,12 +135,23 @@
@SuppressWarnings("unchecked")
private void updateResults() {
- FullTextQuery query = searchQuery(searchQuery);
+
+ javax.persistence.Query query = null;
+ if (searchQuery == null || searchQuery.isEmpty())
+ {
+ query = entityManager.createQuery("from Product");
+ numberOfResults =query.getResultList().size();
+ }
+ else
+ {
+ query = searchQuery(searchQuery);
+ numberOfResults =( (FullTextQuery) query).getResultSize();
+ }
+
List<Product> items = query
.setMaxResults(pageSize + 1)
.setFirstResult(pageSize * currentPage)
- .getResultList();
- numberOfResults = query.getResultSize();
+ .getResultList();
if (items.size() > pageSize) {
searchResults = new ArrayList(items.subList(0, pageSize));