Skip to content

Commit

Permalink
fix: full text search index with sql identifier
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy committed Apr 5, 2024
1 parent 7473f30 commit eed8368
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qtext/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ def text_index(self, table: str) -> sql.SQL:
indexed_columns = (
sql.Identifier(self.text_columns[0])
if len(self.text_columns) == 1
else f"immutable_concat_ws('. ', {', '.join(self.text_columns)})"
else sql.SQL("immutable_concat_ws('. ', {fields})").format(
fields=sql.SQL(", ").join(sql.Identifier(c) for c in self.text_columns)
)
)
return sql.SQL(
"CREATE OR REPLACE FUNCTION immutable_concat_ws(text, VARIADIC text[]) "
Expand Down
1 change: 1 addition & 0 deletions tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ async def hybrid_search(self, namespace: str, query: str):
tabs = self.query(TabPane)
for tab in tabs.nodes:
table = tab.get_child_by_type(DocTable)
table.clear()
docs: RetrieveResponse = getattr(explain, tab.id)
if tab.id == "ranked":
table.fill_rank(docs)
Expand Down

0 comments on commit eed8368

Please sign in to comment.