Skip to content

Commit

Permalink
fix: modify es query rules (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
KingSkyLi authored Jan 23, 2025
1 parent b9f3c97 commit 963521c
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/en-US/developer-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class DevLangService(BaseService):
platform: str = validated_data["platform"]
lang_limit: int = validated_data["lang-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)

if len(res):
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/developer-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class DevLangService(BaseService):
platform: str = validated_data["platform"]
lang_limit: int = validated_data["lang-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)

if len(res):
Expand Down
2 changes: 1 addition & 1 deletion osgraph-service/app/services/graph_services/os_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def execute(self, data: Dict[str, Any]) -> Any:
topic_limit: int = validated_data["topic-limit"]
repo_limit: int = validated_data["repo-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)
if len(res):
user_id = res[0]["id"]
Expand Down
2 changes: 1 addition & 1 deletion osgraph-service/app/services/graph_services/os_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def execute(self, data: Dict[str, Any]) -> Any:
platform: str = validated_data["platform"]
user_limit: int = validated_data["user-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)
if len(res):
user_id = res[0]["id"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def execute(self, data: Dict[str, Any]) -> Any:
country_limit: int = validated_data["country-limit"]
developer_limit: int = validated_data["user-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)
if len(res):
repo_id = res[0]["id"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def execute(self, data: Dict[str, Any]) -> Any:
end_time: int = string_to_timestamp(end_time_str)
repo_limit: int = validated_data["repo-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)
if len(res):
repo_id = res[0]["id"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def execute(self, data: Dict[str, Any]) -> Any:
platform: str = validated_data["platform"]
repo_limit: int = validated_data["repo-limit"]
es = ElasticsearchClient()
query = {"match": {"name": path}}
query = {"match_phrase": {"name": path}}
res = es.search(index=f"{platform}_{input}", query=query, size=1)
if len(res):
repo_id = res[0]["id"]
Expand Down

0 comments on commit 963521c

Please sign in to comment.