Commit b0744e26 authored by Quxl's avatar Quxl

搜索引擎接口

parent 1e29492f
...@@ -73,6 +73,11 @@ ...@@ -73,6 +73,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>6.0.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
package com.egolm.shop.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.service.SolrGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api
@Controller
@RequestMapping("solr/goods")
public class SolrGoodsController {
@Autowired
private SolrGoodsService service;
@ResponseBody
@RequestMapping("query")
@ApiOperation("搜索引擎商品搜索")
public Object query(Page page, String queryKey, String[] keywords, String[] orders, String[] facetFields, String[] facetPivotFields) {
return service.query(page, queryKey, keywords, orders, facetFields, facetPivotFields);
}
@ResponseBody
@RequestMapping("update")
@ApiOperation("搜索引擎更新全部商品索引")
public Object update() {
service.update();
return Rjx.jsonOk();
}
@ResponseBody
@RequestMapping("updateByDistrictID")
@ApiOperation("搜索引擎按区域编号更新商品索引")
public Object updateByDistrictID(String sDistrictID) {
service.update(sDistrictID);
return Rjx.jsonOk();
}
}
package com.egolm.shop.service;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
public interface SolrGoodsService {
public Rjx query(Page page, String queryKey, String[] keywords, String[] orders, String[] facetFields, String[] facetPivotFields);
public void update();
public void update(String sDistrictID);
public void deleteByQuery(String queryKey);
public void deleteById(String[] documentIds);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment