|
|
@@ -44,7 +44,6 @@ import com.uas.search.console.util.SearchUtils;
|
|
|
import com.uas.search.exception.SearchException;
|
|
|
import com.uas.search.grouping.DistinctGroupCollector;
|
|
|
import com.uas.search.model.PageParams;
|
|
|
-import com.uas.search.model.SPage;
|
|
|
import com.uas.search.model.PageParams.FilterField;
|
|
|
import com.uas.search.service.SearchService;
|
|
|
import com.uas.search.sort.SimilarValuesFieldComparatorSource;
|
|
|
@@ -315,7 +314,7 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
ids.add(Long.parseLong(componentId));
|
|
|
// System.out.println(indexSearcher.explain(booleanQuery,
|
|
|
// scoreDoc.doc).toString());
|
|
|
- System.out.println(componentId + "\t" + scoreDoc.score);
|
|
|
+// System.out.println(componentId + "\t" + scoreDoc.score);
|
|
|
}
|
|
|
map.put("componentIds", ids);
|
|
|
map.put("page", pageParams.getPage());
|
|
|
@@ -894,6 +893,38 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
BooleanClause.Occur.FILTER);
|
|
|
}
|
|
|
|
|
|
+ // 价格筛选
|
|
|
+ Object minPriceRmb = filters.get(FilterField.GOODS_MINPRICERMB);
|
|
|
+ Object maxPriceRmb = filters.get(FilterField.GOODS_MAXPRICERMB);
|
|
|
+ Object minPriceUsd = filters.get(FilterField.GOODS_MINPRICEUSD);
|
|
|
+ Object maxPriceUsd = filters.get(FilterField.GOODS_MAXPRICEUSD);
|
|
|
+ // 筛选人民币价格
|
|
|
+ if (!StringUtils.isEmpty(minPriceRmb) || !StringUtils.isEmpty(maxPriceRmb)) {
|
|
|
+ Double minPrice = null;
|
|
|
+ Double maxPrice = null;
|
|
|
+ if (!StringUtils.isEmpty(minPriceRmb)) {
|
|
|
+ minPrice = Double.valueOf(minPriceRmb.toString());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(maxPriceRmb)) {
|
|
|
+ maxPrice = Double.valueOf(maxPriceRmb.toString());
|
|
|
+ }
|
|
|
+ booleanQuery.add(NumericRangeQuery.newDoubleRange(SearchConstants.GOODS_GO_MINPRICERMB_FIELD,
|
|
|
+ minPrice, maxPrice, true, true), BooleanClause.Occur.FILTER);
|
|
|
+ }
|
|
|
+ // 筛选美元价格
|
|
|
+ if (!StringUtils.isEmpty(minPriceUsd) || !StringUtils.isEmpty(maxPriceUsd)) {
|
|
|
+ Double minPrice = null;
|
|
|
+ Double maxPrice = null;
|
|
|
+ if (!StringUtils.isEmpty(minPriceUsd)) {
|
|
|
+ minPrice = Double.valueOf(minPriceUsd.toString());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(maxPriceUsd)) {
|
|
|
+ maxPrice = Double.valueOf(maxPriceUsd.toString());
|
|
|
+ }
|
|
|
+ booleanQuery.add(NumericRangeQuery.newDoubleRange(SearchConstants.GOODS_GO_MINPRICEUSD_FIELD,
|
|
|
+ minPrice, maxPrice, true, true), BooleanClause.Occur.FILTER);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
logger.info(booleanQuery.toString());
|
|
|
|
|
|
@@ -950,7 +981,7 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
cmpIds.add(StringUtils.isEmpty(cmpId) ? null : Long.valueOf(cmpId));
|
|
|
String goId = document.get(SearchConstants.GOODS_GO_ID_FIELD);
|
|
|
goIds.add(StringUtils.isEmpty(goId) ? null : Long.valueOf(goId));
|
|
|
- System.out.println(cmpId + "\t" + goId + "\t" + scoreDoc.score);
|
|
|
+// System.out.println(cmpId + "\t" + goId + "\t" + scoreDoc.score);
|
|
|
}
|
|
|
map.put("componentIds", cmpIds);
|
|
|
map.put("goodsIds", goIds);
|