Search | Community
Skip to main content
Level 2
October 19, 2020

Search

  • October 19, 2020
  • 2 replies
  • 2368 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

Level 4
October 19, 2020

Hi @naoufal_afa ,

 

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

 

Thanks,

Sandeep.

Level 2
October 19, 2020

Hello , this is the map where i pass all the values

String keyword = searchFilter.getKeyword();
Boolean all = searchFilter != null && StringUtils.isNotBlank(searchFilter.getType()) && searchFilter.getType().equals("all");
Boolean documentsSearch = searchFilter != null && StringUtils.isNotBlank(searchFilter.getType()) && searchFilter.getType().equals(QueryConstants.documentsSearch);
Boolean hasCategories = searchFilter.getCategories() != null && searchFilter.getCategories().size() > 0;
Boolean hasSections = searchFilter.getSections() != null && searchFilter.getSections().size() > 0;
Boolean hasResourceTypeList = searchFilter.getResourceTypeList() != null && searchFilter.getResourceTypeList().size() > 0;
Boolean hasContentTypeList = searchFilter.getContentType() != null && searchFilter.getContentType().size() > 0;
Boolean hasRegions = searchFilter.getRegions() != null && searchFilter.getRegions().size() > 0;
Boolean hasBrands = searchFilter.getBrands() != null && searchFilter.getBrands().size() > 0;
Boolean hasAlbums = searchFilter.getAlbums() != null && searchFilter.getAlbums().size() > 0;
Boolean hasHighlights = searchFilter.getHighlights() != null && searchFilter.getHighlights().size() > 0;
Boolean hasDateFilter = searchFilter.getDateStart() != null || searchFilter.getDateEnd() != null;
//String dateStrFormatted = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(new Date());

//*** GROUP 0 - GENERAL GROUP - IF WE ARE SEARCHING FOR ALL WE WILL CREATE GP1 AND GP2, IN DOCUMENTS PAGE GP1, IN OTHER SPECIFIC CASE GP2 ***//
Map<String, String> map = new HashMap<>();
if (all) {
map.put("0_group.p.or", "true");
}
if (all || documentsSearch) {
map.put("0_group.1_group.type", "dam:AssetContent");
}
if (all || !documentsSearch) {
map.put("0_group.2_group.type", "cq:PageContent");
}

 

//Hide In Search is missing
map.put("0_group.2_group.2_group.3_property", "@hideInSearch");
map.put("0_group.2_group.2_group.3_property.value", "true");
map.put("0_group.2_group.2_group.3_property.operation", "not");

int groupIndex = 3;

//***COMMON GROUP - GROUP ASSET AND GROUP PAGECONTENT USE CATEGORIES AND CUSTOMDATE***//
// Date Range
if (hasDateFilter) {
map.put("1_group.daterange.property", "@customDate");
if (searchFilter.getDateStart() != null) {
map.put("1_group.daterange.lowerBound", EnelCommonUtils.formatDate(searchFilter.getDateStart().getTime(), "yyyy-MM-dd", null));
map.put("1_group.daterange.lowerOperation", ">=");
}
if (searchFilter.getDateEnd() != null) {
map.put("1_group.daterange.upperBound", EnelCommonUtils.formatDate(searchFilter.getDateEnd().getTime(), "yyyy-MM-dd", null));
}
}

 

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