com.macro.mall.search.domain.EsProduct Java Examples

The following examples show how to use com.macro.mall.search.domain.EsProduct. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "简单搜索")
@RequestMapping(value = "/search/simple", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
                                                  @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                  @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #2
Source File: EsProductController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据商品id推荐商品")
@RequestMapping(value = "/recommend/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> recommend(@PathVariable Long id,
                                                     @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                     @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.recommend(id, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #3
Source File: EsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
        defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
                                                  @RequestParam(required = false) Long brandId,
                                                  @RequestParam(required = false) Long productCategoryId,
                                                  @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                  @RequestParam(required = false, defaultValue = "5") Integer pageSize,
                                                  @RequestParam(required = false, defaultValue = "0") Integer sort) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #4
Source File: EsProductController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "简单搜索")
@RequestMapping(value = "/search/simple", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
                                                  @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                  @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #5
Source File: EsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据商品id推荐商品")
@RequestMapping(value = "/recommend/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> recommend(@PathVariable Long id,
                                                     @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                     @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.recommend(id, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #6
Source File: EsProductServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public int importAll() {
    List<EsProduct> esProductList = productDao.getAllEsProductList(null);
    Iterable<EsProduct> esProductIterable = productRepository.saveAll(esProductList);
    Iterator<EsProduct> iterator = esProductIterable.iterator();
    int result = 0;
    while (iterator.hasNext()) {
        result++;
        iterator.next();
    }
    return result;
}
 
Example #7
Source File: EsProductServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public Page<EsProduct> recommend(Long id, Integer pageNum, Integer pageSize) {
    Pageable pageable = PageRequest.of(pageNum, pageSize);
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        String keyword = esProduct.getName();
        Long brandId = esProduct.getBrandId();
        Long productCategoryId = esProduct.getProductCategoryId();
        //根据商品标题、品牌、分类进行搜索
        List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("name", keyword),
                ScoreFunctionBuilders.weightFactorFunction(8)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("subTitle", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("keywords", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("brandId", brandId),
                ScoreFunctionBuilders.weightFactorFunction(10)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("productCategoryId", productCategoryId),
                ScoreFunctionBuilders.weightFactorFunction(6)));
        FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
        filterFunctionBuilders.toArray(builders);
        FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
                .scoreMode(FunctionScoreQuery.ScoreMode.SUM)
                .setMinScore(2);
        NativeSearchQueryBuilder builder = new NativeSearchQueryBuilder();
        builder.withQuery(functionScoreQueryBuilder);
        builder.withPageable(pageable);
        NativeSearchQuery searchQuery = builder.build();
        LOGGER.info("DSL:{}", searchQuery.getQuery().toString());
        return productRepository.search(searchQuery);
    }
    return new PageImpl<>(null);
}
 
Example #8
Source File: EsProductServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public EsProduct create(Long id) {
    EsProduct result = null;
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        result = productRepository.save(esProduct);
    }
    return result;
}
 
Example #9
Source File: EsProductServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(List<Long> ids) {
    if (!CollectionUtils.isEmpty(ids)) {
        List<EsProduct> esProductList = new ArrayList<>();
        for (Long id : ids) {
            EsProduct esProduct = new EsProduct();
            esProduct.setId(id);
            esProductList.add(esProduct);
        }
        productRepository.deleteAll(esProductList);
    }
}
 
Example #10
Source File: EsProductController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据id创建商品")
@RequestMapping(value = "/create/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult<EsProduct> create(@PathVariable Long id) {
    EsProduct esProduct = esProductService.create(id);
    if (esProduct != null) {
        return CommonResult.success(esProduct);
    } else {
        return CommonResult.failed();
    }
}
 
Example #11
Source File: EsProductServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int importAll() {
    List<EsProduct> esProductList = productDao.getAllEsProductList(null);
    Iterable<EsProduct> esProductIterable = productRepository.saveAll(esProductList);
    Iterator<EsProduct> iterator = esProductIterable.iterator();
    int result = 0;
    while (iterator.hasNext()) {
        result++;
        iterator.next();
    }
    return result;
}
 
Example #12
Source File: EsProductServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public EsProduct create(Long id) {
    EsProduct result = null;
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        result = productRepository.save(esProduct);
    }
    return result;
}
 
Example #13
Source File: EsProductServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(List<Long> ids) {
    if (!CollectionUtils.isEmpty(ids)) {
        List<EsProduct> esProductList = new ArrayList<>();
        for (Long id : ids) {
            EsProduct esProduct = new EsProduct();
            esProduct.setId(id);
            esProductList.add(esProduct);
        }
        productRepository.deleteAll(esProductList);
    }
}
 
Example #14
Source File: EsProductServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public Page<EsProduct> recommend(Long id, Integer pageNum, Integer pageSize) {
    Pageable pageable = PageRequest.of(pageNum, pageSize);
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        String keyword = esProduct.getName();
        Long brandId = esProduct.getBrandId();
        Long productCategoryId = esProduct.getProductCategoryId();
        //根据商品标题、品牌、分类进行搜索
        List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("name", keyword),
                ScoreFunctionBuilders.weightFactorFunction(8)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("subTitle", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("keywords", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("brandId", brandId),
                ScoreFunctionBuilders.weightFactorFunction(10)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("productCategoryId", productCategoryId),
                ScoreFunctionBuilders.weightFactorFunction(6)));
        FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
        filterFunctionBuilders.toArray(builders);
        FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
                .scoreMode(FunctionScoreQuery.ScoreMode.SUM)
                .setMinScore(2);
        NativeSearchQueryBuilder builder = new NativeSearchQueryBuilder();
        builder.withQuery(functionScoreQueryBuilder);
        builder.withPageable(pageable);
        NativeSearchQuery searchQuery = builder.build();
        LOGGER.info("DSL:{}", searchQuery.getQuery().toString());
        return productRepository.search(searchQuery);
    }
    return new PageImpl<>(null);
}
 
Example #15
Source File: EsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据id创建商品")
@RequestMapping(value = "/create/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult<EsProduct> create(@PathVariable Long id) {
    EsProduct esProduct = esProductService.create(id);
    if (esProduct != null) {
        return CommonResult.success(esProduct);
    } else {
        return CommonResult.failed();
    }
}
 
Example #16
Source File: EsProductController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "简单搜索")
@RequestMapping(value = "/search/simple", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
                                                  @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                  @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #17
Source File: EsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
        defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> search(@RequestParam(required = false) String keyword,
                                                  @RequestParam(required = false) Long brandId,
                                                  @RequestParam(required = false) Long productCategoryId,
                                                  @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                  @RequestParam(required = false, defaultValue = "5") Integer pageSize,
                                                  @RequestParam(required = false, defaultValue = "0") Integer sort) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #18
Source File: EsProductController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据商品id推荐商品")
@RequestMapping(value = "/recommend/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<EsProduct>> recommend(@PathVariable Long id,
                                                     @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                                                     @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.recommend(id, pageNum, pageSize);
    return CommonResult.success(CommonPage.restPage(esProductPage));
}
 
Example #19
Source File: EsProductServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public int importAll() {
    List<EsProduct> esProductList = productDao.getAllEsProductList(null);
    Iterable<EsProduct> esProductIterable = productRepository.saveAll(esProductList);
    Iterator<EsProduct> iterator = esProductIterable.iterator();
    int result = 0;
    while (iterator.hasNext()) {
        result++;
        iterator.next();
    }
    return result;
}
 
Example #20
Source File: EsProductServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public EsProduct create(Long id) {
    EsProduct result = null;
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        result = productRepository.save(esProduct);
    }
    return result;
}
 
Example #21
Source File: EsProductServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(List<Long> ids) {
    if (!CollectionUtils.isEmpty(ids)) {
        List<EsProduct> esProductList = new ArrayList<>();
        for (Long id : ids) {
            EsProduct esProduct = new EsProduct();
            esProduct.setId(id);
            esProductList.add(esProduct);
        }
        productRepository.deleteAll(esProductList);
    }
}
 
Example #22
Source File: EsProductServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public Page<EsProduct> recommend(Long id, Integer pageNum, Integer pageSize) {
    Pageable pageable = PageRequest.of(pageNum, pageSize);
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        String keyword = esProduct.getName();
        Long brandId = esProduct.getBrandId();
        Long productCategoryId = esProduct.getProductCategoryId();
        //根据商品标题、品牌、分类进行搜索
        List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("name", keyword),
                ScoreFunctionBuilders.weightFactorFunction(8)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("subTitle", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("keywords", keyword),
                ScoreFunctionBuilders.weightFactorFunction(2)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("brandId", brandId),
                ScoreFunctionBuilders.weightFactorFunction(5)));
        filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchQuery("productCategoryId", productCategoryId),
                ScoreFunctionBuilders.weightFactorFunction(3)));
        FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
        filterFunctionBuilders.toArray(builders);
        FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
                .scoreMode(FunctionScoreQuery.ScoreMode.SUM)
                .setMinScore(2);
        //用于过滤掉相同的商品
        BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
        boolQueryBuilder.mustNot(QueryBuilders.termQuery("id",id));
        //构建查询条件
        NativeSearchQueryBuilder builder = new NativeSearchQueryBuilder();
        builder.withQuery(functionScoreQueryBuilder);
        builder.withFilter(boolQueryBuilder);
        builder.withPageable(pageable);
        NativeSearchQuery searchQuery = builder.build();
        LOGGER.info("DSL:{}", searchQuery.getQuery().toString());
        return productRepository.search(searchQuery);
    }
    return new PageImpl<>(null);
}
 
Example #23
Source File: EsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation(value = "根据id创建商品")
@RequestMapping(value = "/create/{id}", method = RequestMethod.POST)
@ResponseBody
public Object create(@PathVariable Long id) {
    EsProduct esProduct = esProductService.create(id);
    if (esProduct != null) {
        return new CommonResult().success(esProduct);
    } else {
        return new CommonResult().failed();
    }
}
 
Example #24
Source File: EsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation(value = "简单搜索")
@RequestMapping(value = "/search/simple", method = RequestMethod.GET)
@ResponseBody
public Object search(@RequestParam(required = false) String keyword,
                     @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                     @RequestParam(required = false, defaultValue = "5") Integer pageSize) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, pageNum, pageSize);
    return new CommonResult().pageSuccess(esProductPage);
}
 
Example #25
Source File: EsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation(value = "综合搜索、筛选、排序")
@ApiImplicitParam(name = "sort", value = "排序字段:0->按相关度;1->按新品;2->按销量;3->价格从低到高;4->价格从高到低",
        defaultValue = "0", allowableValues = "0,1,2,3,4", paramType = "query", dataType = "integer")
@RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody
public Object search(@RequestParam(required = false) String keyword,
                     @RequestParam(required = false) Long brandId,
                     @RequestParam(required = false) Long productCategoryId,
                     @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                     @RequestParam(required = false, defaultValue = "5") Integer pageSize,
                     @RequestParam(required = false, defaultValue = "0") Integer sort) {
    Page<EsProduct> esProductPage = esProductService.search(keyword, brandId, productCategoryId, pageNum, pageSize, sort);
    return new CommonResult().pageSuccess(esProductPage);
}
 
Example #26
Source File: EsProductController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation(value = "根据商品id推荐商品")
@RequestMapping(value = "/recommend/{id}",method = RequestMethod.GET)
@ResponseBody
public Object recommend(@PathVariable Long id,
                        @RequestParam(required = false, defaultValue = "0") Integer pageNum,
                        @RequestParam(required = false, defaultValue = "5") Integer pageSize){
    Page<EsProduct> esProductPage = esProductService.recommend(id, pageNum, pageSize);
    return new CommonResult().pageSuccess(esProductPage);
}
 
Example #27
Source File: EsProductServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public int importAll() {
    List<EsProduct> esProductList = productDao.getAllEsProductList(null);
    Iterable<EsProduct> esProductIterable = productRepository.save(esProductList);
    Iterator<EsProduct> iterator = esProductIterable.iterator();
    int result = 0;
    while (iterator.hasNext()) {
        result++;
        iterator.next();
    }
    return result;
}
 
Example #28
Source File: EsProductServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public EsProduct create(Long id) {
    EsProduct result = null;
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        result = productRepository.save(esProduct);
    }
    return result;
}
 
Example #29
Source File: EsProductServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public void delete(List<Long> ids) {
    if (!CollectionUtils.isEmpty(ids)) {
        List<EsProduct> esProductList = new ArrayList<>();
        for (Long id : ids) {
            EsProduct esProduct = new EsProduct();
            esProduct.setId(id);
            esProductList.add(esProduct);
        }
        productRepository.delete(esProductList);
    }
}
 
Example #30
Source File: EsProductServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public Page<EsProduct> recommend(Long id, Integer pageNum, Integer pageSize) {
    Pageable pageable = new PageRequest(pageNum, pageSize);
    List<EsProduct> esProductList = productDao.getAllEsProductList(id);
    if (esProductList.size() > 0) {
        EsProduct esProduct = esProductList.get(0);
        String keyword = esProduct.getName();
        Long brandId = esProduct.getBrandId();
        Long productCategoryId = esProduct.getProductCategoryId();
        //根据商品标题、品牌、分类进行搜索
        FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery()
                .add(QueryBuilders.matchQuery("name",keyword),ScoreFunctionBuilders.weightFactorFunction(8))
                .add(QueryBuilders.matchQuery("subTitle",keyword),ScoreFunctionBuilders.weightFactorFunction(2))
                .add(QueryBuilders.matchQuery("keywords",keyword),ScoreFunctionBuilders.weightFactorFunction(2))
                .add(QueryBuilders.termQuery("brandId",brandId),ScoreFunctionBuilders.weightFactorFunction(10))
                .add(QueryBuilders.matchQuery("productCategoryId",productCategoryId),ScoreFunctionBuilders.weightFactorFunction(6))
                .scoreMode("sum")
                .setMinScore(2);
        NativeSearchQueryBuilder builder = new NativeSearchQueryBuilder();
        builder.withQuery(functionScoreQueryBuilder);
        builder.withPageable(pageable);
        NativeSearchQuery searchQuery = builder.build();
        LOGGER.info("DSL:{}", searchQuery.getQuery().toString());
        return productRepository.search(searchQuery);
    }
    return new PageImpl<>(null);
}