Fix linting
This commit is contained in:
parent
8e2a1fa59e
commit
5da1df3b19
1 changed files with 18 additions and 12 deletions
|
|
@ -72,7 +72,7 @@ class Neo4JStorage(BaseGraphStorage):
|
||||||
|
|
||||||
def _is_chinese_text(self, text: str) -> bool:
|
def _is_chinese_text(self, text: str) -> bool:
|
||||||
"""Check if text contains Chinese characters."""
|
"""Check if text contains Chinese characters."""
|
||||||
chinese_pattern = re.compile(r'[\u4e00-\u9fff]+')
|
chinese_pattern = re.compile(r"[\u4e00-\u9fff]+")
|
||||||
return bool(chinese_pattern.search(text))
|
return bool(chinese_pattern.search(text))
|
||||||
|
|
||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
|
|
@ -251,7 +251,9 @@ class Neo4JStorage(BaseGraphStorage):
|
||||||
if existing_index:
|
if existing_index:
|
||||||
# Check if the existing index has CJK analyzer
|
# Check if the existing index has CJK analyzer
|
||||||
index_config = existing_index.get("options", {})
|
index_config = existing_index.get("options", {})
|
||||||
current_analyzer = index_config.get("indexConfig", {}).get("fulltext.analyzer", "standard")
|
current_analyzer = index_config.get("indexConfig", {}).get(
|
||||||
|
"fulltext.analyzer", "standard"
|
||||||
|
)
|
||||||
|
|
||||||
if current_analyzer != "cjk":
|
if current_analyzer != "cjk":
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
@ -272,9 +274,13 @@ class Neo4JStorage(BaseGraphStorage):
|
||||||
drop_query = f"DROP INDEX {index_name}"
|
drop_query = f"DROP INDEX {index_name}"
|
||||||
result = await session.run(drop_query)
|
result = await session.run(drop_query)
|
||||||
await result.consume()
|
await result.consume()
|
||||||
logger.info(f"[{self.workspace}] Dropped existing index '{index_name}'")
|
logger.info(
|
||||||
|
f"[{self.workspace}] Dropped existing index '{index_name}'"
|
||||||
|
)
|
||||||
except Exception as drop_error:
|
except Exception as drop_error:
|
||||||
logger.warning(f"[{self.workspace}] Failed to drop existing index: {str(drop_error)}")
|
logger.warning(
|
||||||
|
f"[{self.workspace}] Failed to drop existing index: {str(drop_error)}"
|
||||||
|
)
|
||||||
|
|
||||||
# Create new index with CJK analyzer
|
# Create new index with CJK analyzer
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue