@@ -162,26 +162,23 @@ def get_full_texts(self, collection_config_folder: str, source: str = None) -> A
162
162
Retrieves the full texts, URLs, and titles for a specified collection.
163
163
164
164
Returns:
165
- dict: A JSON response containing the results of the SQL query in an expected format under the 'Rows' key ,
166
- where each item has 'url1 ', 'text', and 'title' .
165
+ dict: A JSON response containing the results of the SQL query,
166
+ where each item has 'url ', 'text', and 'title'.
167
167
168
168
Example:
169
169
Calling get_full_texts("example_collection") might return:
170
- {
171
- 'Rows': [
170
+ [
172
171
{
173
- 'url1 ': 'http://example.com/article1',
172
+ 'url ': 'http://example.com/article1',
174
173
'text': 'Here is the full text of the first article...',
175
174
'title': 'Article One Title'
176
175
},
177
176
{
178
- 'url1 ': 'http://example.com/article2',
177
+ 'url ': 'http://example.com/article2',
179
178
'text': 'Here is the full text of the second article...',
180
179
'title': 'Article Two Title'
181
180
}
182
181
]
183
- }
184
-
185
182
"""
186
183
187
184
if not source :
@@ -191,4 +188,11 @@ def get_full_texts(self, collection_config_folder: str, source: str = None) -> A
191
188
raise ValueError ("Index not defined for this server" )
192
189
193
190
sql = f"SELECT url1, text, title FROM { index } WHERE collection = '/{ source } /{ collection_config_folder } /'"
194
- return self .sql_query (sql )
191
+ full_text_response = self .sql_query (sql )
192
+ return self ._process_full_text_response (full_text_response )
193
+
194
+ @staticmethod
195
+ def _process_full_text_response (full_text_response : str ):
196
+ return [
197
+ {"url" : url , "full_text" : full_text , "title" : title } for url , full_text , title in full_text_response ["Rows" ]
198
+ ]
0 commit comments