Skip to content

Commit 8fd459c

Browse files
committed
fix: channel ensure index exists
1 parent 2c114ab commit 8fd459c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/backend/bisheng/channel/domain/services/article_es_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async def _get_client(self) -> AsyncElasticsearch:
3535
"""Get ES client, lazy loading"""
3636
if self._es_client is None:
3737
self._es_client = await get_es_connection()
38+
await self.ensure_index()
3839
return self._es_client
3940

4041
async def ensure_index(self) -> None:
@@ -448,7 +449,7 @@ async def count_articles_batch(
448449
body.append({"query": query, "size": 0})
449450

450451
response = await client.msearch(body=body)
451-
452+
452453
counts = []
453454
for i, r in enumerate(response["responses"]):
454455
if i in zero_indices:
@@ -565,7 +566,8 @@ async def search_articles(
565566
"post_tags": ["</em>"],
566567
"fields": {
567568
"title": {"number_of_fragments": 0, "highlight_query": highlight_query},
568-
"content": {"fragment_size": 200, "number_of_fragments": 3, "highlight_query": highlight_query, "max_analyzed_offset": 999999},
569+
"content": {"fragment_size": 200, "number_of_fragments": 3, "highlight_query": highlight_query,
570+
"max_analyzed_offset": 999999},
569571
},
570572
}
571573

0 commit comments

Comments
 (0)