tagsearch with QueryBuilder is not working from the dispatcher
I have the following
String content = "/content/site";
String text = get("text", String.class);
ResourceResolver resolver = getResourceResolver();
Session session = resolver.adaptTo(Session.class);
QueryBuilder builder = getSlingScriptHelper().getService(QueryBuilder.class);
Map<String, String> queryTag = new HashMap<>();
map.put("path", content);
map.put("tagsearch", text);
map.put("p.offset",0);
map.put("p.limit",-1);
Query query = builder.createQuery(PredicateGroup.create(queryTag), session);
SearchResult result = query.getResult();
LOG.debug("Total: " + result.getTotalMatches());
In my local environment, and also in the development environment when I search without going through the dispatcher, it finds the content through the tag without any issues. However, when I search through the dispatcher, it doesn't return any results. When I query the site through the dispatcher, the log shows 0 results, but when the dispatcher is bypassed, it does return results. The strange thing is that when I search by fulltext instead of tag, searching for content through the dispatcher does work. Is there any functionality in the dispatcher that could be blocking the search through tagsearch?