|
@@ -17,13 +17,13 @@ class BaseMySQLClient:
|
|
|
|
|
|
class Contents(BaseMySQLClient):
|
|
class Contents(BaseMySQLClient):
|
|
|
|
|
|
- async def insert_content(self, doc_id, text):
|
|
|
|
|
|
+ async def insert_content(self, doc_id, text, text_type):
|
|
query = """
|
|
query = """
|
|
INSERT IGNORE INTO contents
|
|
INSERT IGNORE INTO contents
|
|
- (doc_id, text)
|
|
|
|
- VALUES (%s, %s);
|
|
|
|
|
|
+ (doc_id, text, text_type)
|
|
|
|
+ VALUES (%s, %s, %s);
|
|
"""
|
|
"""
|
|
- return await self.pool.async_save(query=query, params=(doc_id, text))
|
|
|
|
|
|
+ return await self.pool.async_save(query=query, params=(doc_id, text, text_type))
|
|
|
|
|
|
async def update_content_status(self, doc_id, ori_status, new_status):
|
|
async def update_content_status(self, doc_id, ori_status, new_status):
|
|
query = """
|
|
query = """
|
|
@@ -41,8 +41,8 @@ class ContentChunks(BaseMySQLClient):
|
|
async def insert_chunk(self, chunk: Chunk) -> int:
|
|
async def insert_chunk(self, chunk: Chunk) -> int:
|
|
query = """
|
|
query = """
|
|
INSERT IGNORE INTO content_chunks
|
|
INSERT IGNORE INTO content_chunks
|
|
- (chunk_id, doc_id, text, tokens, topic_purity)
|
|
|
|
- VALUES (%s, %s, %s, %s, %s);
|
|
|
|
|
|
+ (chunk_id, doc_id, text, tokens, topic_purity, text_type)
|
|
|
|
+ VALUES (%s, %s, %s, %s, %s, %s);
|
|
"""
|
|
"""
|
|
return await self.pool.async_save(
|
|
return await self.pool.async_save(
|
|
query=query,
|
|
query=query,
|
|
@@ -52,6 +52,7 @@ class ContentChunks(BaseMySQLClient):
|
|
chunk.text,
|
|
chunk.text,
|
|
chunk.tokens,
|
|
chunk.tokens,
|
|
chunk.topic_purity,
|
|
chunk.topic_purity,
|
|
|
|
+ chunk.text_type
|
|
),
|
|
),
|
|
)
|
|
)
|
|
|
|
|