Skip to content

Commit 48b5e63

Browse files
author
Your Name
committed
Issue #1077 and #1085
1 parent 7ba1078 commit 48b5e63

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

sde_collections/admin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def import_sinequa_metadata(modeladmin, request, queryset):
7777
for collection in queryset.all():
7878
# eventually this needs to be done in celery
7979
collection.import_metadata_from_sinequa_config()
80+
collection_names = ", ".join(queryset.values_list("name", flat=True))
8081
messages.add_message(
8182
request,
8283
messages.INFO,

sde_collections/sinequa_api.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,31 @@ def sql_query(self, sql: str) -> Any:
124124
raise Exception(f"API request failed: {str(e)}")
125125

126126
def get_full_texts(self, collection_config_folder: str) -> Any:
127+
'''
128+
Retrieves the full texts, URLs, and titles for a specified collection.
129+
130+
Returns:
131+
dict: A JSON response containing the results of the SQL query in an expected format under the 'Rows' key,
132+
where each item has 'url1', 'text', and 'title' .
133+
134+
Example:
135+
Calling get_full_texts("example_collection") might return:
136+
{
137+
'Rows': [
138+
{
139+
'url1': 'http://example.com/article1',
140+
'text': 'Here is the full text of the first article...',
141+
'title': 'Article One Title'
142+
},
143+
{
144+
'url1': 'http://example.com/article2',
145+
'text': 'Here is the full text of the second article...',
146+
'title': 'Article Two Title'
147+
}
148+
]
149+
}
150+
151+
'''
127152
sql = f"SELECT url1, text, title FROM sde_index WHERE collection = '/SDE/{collection_config_folder}/'"
128153
return self.sql_query(sql)
154+

0 commit comments

Comments
 (0)