Search | Community
Skip to main content
October 19, 2020

Search

  • October 19, 2020
  • 2 replies
  • 2363 views

i want to brings all the pages that contains special character and without special character in the same query

this is my query , how can i do that ?

 

public SearchResult generalSearch(Map mapQuerySearch) {
try {
startTiming();
Map<String, String> map = new HashMap<>();
map = mapQuerySearch;
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();
endTiming(map);
return result;
} catch (Exception e) {
log.error("QueryBsn - General search error",e);
}
return null;
}


thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

October 19, 2020

Hi @naoufal_afa ,

 

Could you please provide me the map , what your passing in  generalSearch method.

 

Thanks,

Sandeep.

October 19, 2020

Hello  this all the value i pass in the map 

String keyword = searchFilter.getKeyword(); Map<String, String> map = new HashMap<>(); if(searchFilter.getContentType() == null || searchFilter.getContentType().size() == 0) { //We are not searching resources map.put("type", "cq:PageContent"); } List searchPaths = searchFilter.getPaths(); if (searchPaths.size() <= 1) { map.put("path", searchPaths.get(0)); } else { for (int i = 0; i < searchPaths.size(); i++) { map.put("group." + (i + 1) + "_path", searchPaths.get(i)); } } if (searchFilter.getResourceTypeList() != null && searchFilter.getResourceTypeList().size() > 0) { map.put("1_property", "@sling:resourceType"); //Add all resource types to find if (searchFilter.getResourceTypeList() != null) { for (int i = 0; i < searchFilter.getResourceTypeList().size(); i++) { int groupIndex = 1 + i; map.put("1_property."+groupIndex+"_value", searchFilter.getResourceTypeList().get(i)); } } //Hide In Search is missing map.put("3_property", "@hideInSearch"); map.put("3_property.value", "true"); map.put("3_property.operation", "not"); } else { if(searchFilter.getContentType() != null && searchFilter.getContentType().size() > 0) { map.put("1_property", "fileReference"); setContentTypeFilter(map, "1_property", searchFilter.getContentType(), "like"); } } map.put("group.p.or", "true"); if (searchFilter.getTypologies() != null && searchFilter.getTypologies().size() > 0) { if(!searchFilter.getType().equals("all")){ for (String typology : searchFilter.getTypologies()) { groupIndex++; map.put("group."+groupIndex+"_property", "@"+QueryConstants.typology); map.put("group."+groupIndex+"_property.value", QueryConstants.NAMESPACE_TYPOLOGY+":"+typology); } } } if (StringUtils.isNotBlank(keyword)) { //Common for all articles map.put("fulltext", keyword); } map.put("orderby", "@customDate"); map.put("orderby.sort", orderBy); map.put("p.offset", "0"); map.put("p.limit",limit);

arunpatidar
Community Advisor
Community Advisor
October 25, 2020

Do you want all the pages in same results(page with special char & page without special char).

Create 2 sets - One with all page and another with special character. Get difference of two sets to get pages without special character

Arun Patidar