Commit e4ac2ff 1 parent c540eb3 commit e4ac2ff Copy full SHA for e4ac2ff
File tree 2 files changed +3
-51
lines changed
spring-data-elasticsearch-query/src/main/java/org/spring/springboot
2 files changed +3
-51
lines changed Original file line number Diff line number Diff line change 14
14
* Created by bysocket on 20/06/2017.
15
15
*/
16
16
public interface CityRepository extends ElasticsearchRepository <City , Long > {
17
- /**
18
- * AND 语句查询
19
- *
20
- * @param description
21
- * @param score
22
- * @return
23
- */
24
- List <City > findByDescriptionAndScore (String description , Integer score );
25
-
26
- /**
27
- * OR 语句查询
28
- *
29
- * @param description
30
- * @param score
31
- * @return
32
- */
33
- List <City > findByDescriptionOrScore (String description , Integer score );
34
-
35
- /**
36
- * 查询城市描述
37
- *
38
- * 等同于下面代码
39
- * @Query("{\"bool\" : {\"must\" : {\"term\" : {\"description\" : \"?0\"}}}}")
40
- * Page<City> findByDescription(String description, Pageable pageable);
41
- *
42
- * @param description
43
- * @param page
44
- * @return
45
- */
46
- Page <City > findByDescription (String description , Pageable page );
47
-
48
- /**
49
- * NOT 语句查询
50
- *
51
- * @param description
52
- * @param page
53
- * @return
54
- */
55
- Page <City > findByDescriptionNot (String description , Pageable page );
56
-
57
- /**
58
- * LIKE 语句查询
59
- *
60
- * @param description
61
- * @param page
62
- * @return
63
- */
64
- Page <City > findByDescriptionLike (String description , Pageable page );
65
17
66
18
}
Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ public class CityESServiceImpl implements CityService {
29
29
private static final Logger LOGGER = LoggerFactory .getLogger (CityESServiceImpl .class );
30
30
31
31
/* 分页参数 */
32
- Integer PAGE_SIZE = 12 ; // 每页数量
32
+ Integer PAGE_SIZE = 12 ; // 每页数量
33
33
Integer DEFAULT_PAGE_NUMBER = 0 ; // 默认当前页码
34
34
35
35
/* 搜索模式 */
36
36
String SCORE_MODE_SUM = "sum" ; // 权重分求和模式
37
- Float MIN_SCORE = 10.0F ; // 由于无相关性的分值默认为 1 ,设置权重分最小值为 10
37
+ Float MIN_SCORE = 10.0F ; // 由于无相关性的分值默认为 1 ,设置权重分最小值为 10
38
38
39
39
@ Autowired
40
- CityRepository cityRepository ;// ES 操作类
40
+ CityRepository cityRepository ; // ES 操作类
41
41
42
42
public Long saveCity (City city ) {
43
43
City cityResult = cityRepository .save (city );
You can’t perform that action at this time.
0 commit comments