Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
66a77c5d
Commit
66a77c5d
authored
Jul 28, 2021
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
es 查询模糊的问题
parent
b185ad49
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
ESService.java
...main/java/com/tanpu/community/service/base/ESService.java
+3
-2
No files found.
community-service/src/main/java/com/tanpu/community/service/base/ESService.java
View file @
66a77c5d
...
...
@@ -9,6 +9,7 @@ import com.tanpu.community.dao.entity.community.ThemeEntity;
import
com.tanpu.community.model.ESWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchPhraseQueryBuilder
;
import
org.elasticsearch.index.query.MatchQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
...
...
@@ -44,8 +45,8 @@ public class ESService {
SearchSourceBuilder
search
=
new
SearchSourceBuilder
();
BoolQueryBuilder
boolQb
=
QueryBuilders
.
boolQuery
();
Match
QueryBuilder
contentQb
=
QueryBuilders
.
match
Query
(
"textContent"
,
keyword
);
Match
QueryBuilder
titleQb
=
QueryBuilders
.
match
Query
(
"title"
,
keyword
);
Match
PhraseQueryBuilder
contentQb
=
QueryBuilders
.
matchPhrase
Query
(
"textContent"
,
keyword
);
Match
PhraseQueryBuilder
titleQb
=
QueryBuilders
.
matchPhrase
Query
(
"title"
,
keyword
);
boolQb
.
should
(
contentQb
);
boolQb
.
should
(
titleQb
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment