alstonan25
alstonan25

Reputation: 23

AEM Querybuilder offset issues

I am attempting to use AEM querybuilder to create another search component. I have created a property to link the offset to the url for the search. The problem I am getting is that when changing the offset I am getting some of the past results from previous pages on the bottom of the newer pages. Is there another condition I must add to the querybuilder code for the offset to show completely different results based on my page limit set?

-Page next to p.offset is the property I am using to send the offset into the URL. I am getting the same problem using '0' so the problem is with the set up of the querybuilder itself.

Map<String, String> map=new HashMap<String, String>();
QueryBuilder queryBuilder;
String paths = properties.get("paths", "/content");
//Writing Query Description that goes to form a Query
map.put("path", paths);
map.put("type", "cq:Page");
map.put("group.p.or", "true"); // combine this group with OR
map.put("group.1_fulltext", fulltextSearchTerm);
map.put("group.1_fulltext.relPath", "jcr:content");
map.put("group.2_fulltext", fulltextSearchTerm);
map.put("group.2_fulltext.relPath", "jcr:content/@cq:tags");
map.put("p.offset", Page); // same as query.setStart(0) below
map.put("p.limit", "10"); // same as query.setHitsPerPage(10) below

Upvotes: 0

Views: 1295

Answers (1)

alstonan25
alstonan25

Reputation: 23

So I solved the problem. The offset is the position in which the search results display in AEM so the offset goes off of how many hitsperPage you set since I set 10 per page the results will only show the next page after the offset is at 10 or more.

Upvotes: 0

Related Questions