Basic Postgres tsquery text query
(self, query)
| 1075 | return q_string |
| 1076 | |
| 1077 | def basic_query(self, query): |
| 1078 | |
| 1079 | """Basic Postgres tsquery text query""" |
| 1080 | |
| 1081 | search_string = self._prep_query(query) |
| 1082 | |
| 1083 | sql_query = f"SELECT ts_rank_cd (ts, to_tsquery('english', '{search_string}')) as rank, * " \ |
| 1084 | f"FROM {self.library_name} " \ |
| 1085 | f"WHERE ts @@ to_tsquery('english', '{search_string}') " \ |
| 1086 | f"ORDER BY rank DESC LIMIT 100 ;" |
| 1087 | |
| 1088 | results = self.conn.cursor().execute(sql_query) |
| 1089 | |
| 1090 | output_results = self.unpack_search_result(results) |
| 1091 | |
| 1092 | self.conn.close() |
| 1093 | |
| 1094 | return output_results |
| 1095 | |
| 1096 | def filter_by_key(self, key, value): |
| 1097 |
no test coverage detected