| Line 164... |
Line 164... |
| 164 |
return documentMap;
|
164 |
return documentMap;
|
| 165 |
}
|
165 |
}
|
| 166 |
|
166 |
|
| 167 |
// This method is the used to pull docs based on search and shall be used
|
167 |
// This method is the used to pull docs based on search and shall be used
|
| 168 |
// interchangably for both the things
|
168 |
// interchangably for both the things
|
| - |
|
169 |
public static String brandExclusionFq(List<String> excludeBrands) {
|
| - |
|
170 |
if (excludeBrands == null || excludeBrands.isEmpty()) {
|
| - |
|
171 |
return null;
|
| - |
|
172 |
}
|
| - |
|
173 |
return "-brand_ss:(" + excludeBrands.stream().map(x -> "\"" + x + "\"").collect(Collectors.joining(" OR "))
|
| - |
|
174 |
+ ")";
|
| - |
|
175 |
}
|
| - |
|
176 |
|
| 169 |
public JSONArray getSolrDocs(String queryTerm, String categoryId, int offset, int limit, String sort,
|
177 |
public JSONArray getSolrDocs(String queryTerm, String categoryId, int offset, int limit, String sort,
|
| 170 |
String brand, int subCategoryId, boolean hotDeal, boolean group, boolean eol_filter) throws Throwable {
|
178 |
String brand, int subCategoryId, boolean hotDeal, boolean group, boolean eol_filter) throws Throwable {
|
| - |
|
179 |
return this.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal, group,
|
| - |
|
180 |
eol_filter, null);
|
| - |
|
181 |
}
|
| - |
|
182 |
|
| - |
|
183 |
public JSONArray getSolrDocs(String queryTerm, String categoryId, int offset, int limit, String sort,
|
| - |
|
184 |
String brand, int subCategoryId, boolean hotDeal, boolean group, boolean eol_filter,
|
| - |
|
185 |
List<String> excludeBrands) throws Throwable {
|
| 171 |
List<String> parentFilter = new ArrayList<>();
|
186 |
List<String> parentFilter = new ArrayList<>();
|
| 172 |
parentFilter.add("categoryId_i:" + categoryId);
|
187 |
parentFilter.add("categoryId_i:" + categoryId);
|
| 173 |
parentFilter.add("show_default_b:true");
|
188 |
parentFilter.add("show_default_b:true");
|
| 174 |
List<String> childFilter = new ArrayList<>();
|
189 |
List<String> childFilter = new ArrayList<>();
|
| 175 |
childFilter.add("itemId_i:*");
|
190 |
childFilter.add("itemId_i:*");
|
| Line 207... |
Line 222... |
| 207 |
String.format("*, [child parentFilter=id:catalog* childFilter=%s]", "\"" + childFilterString + "\""));
|
222 |
String.format("*, [child parentFilter=id:catalog* childFilter=%s]", "\"" + childFilterString + "\""));
|
| 208 |
params.put("start", String.valueOf(offset));
|
223 |
params.put("start", String.valueOf(offset));
|
| 209 |
params.put("rows", String.valueOf(limit));
|
224 |
params.put("rows", String.valueOf(limit));
|
| 210 |
params.put("wt", "json");
|
225 |
params.put("wt", "json");
|
| 211 |
|
226 |
|
| - |
|
227 |
String exclusionFq = brandExclusionFq(excludeBrands);
|
| - |
|
228 |
if (exclusionFq != null) {
|
| - |
|
229 |
params.put("fq", exclusionFq);
|
| - |
|
230 |
}
|
| - |
|
231 |
|
| 212 |
String groupByField = null;
|
232 |
String groupByField = null;
|
| 213 |
|
233 |
|
| 214 |
if (group) {
|
234 |
if (group) {
|
| 215 |
groupByField = "superCatalog_s";
|
235 |
groupByField = "superCatalog_s";
|
| 216 |
params.put("group", String.valueOf(group));
|
236 |
params.put("group", String.valueOf(group));
|