Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions app/backend/prepdocslib/searchmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,28 +471,33 @@ async def update_content(self, sections: list[Section], url: Optional[str] = Non

async with self.search_info.create_search_client() as search_client:
for batch_index, batch in enumerate(section_batches):
documents = [
{
documents = []
for section_index, section in enumerate(batch):
image_fields = {}
if self.search_images:
image_fields = {
"images": [
{
"url": image.url,
"description": image.description,
"boundingbox": image.bbox,
"embedding": image.embedding,
}
for image in section.chunk.images
]
}
document = {
"id": f"{section.content.filename_to_id()}-page-{section_index + batch_index * MAX_BATCH_SIZE}",
"content": section.chunk.text,
"category": section.category,
"sourcepage": BlobManager.sourcepage_from_file_page(
filename=section.content.filename(), page=section.chunk.page_num
),
"sourcefile": section.content.filename(),
"images": [
{
"url": image.url,
"description": image.description,
"boundingbox": image.bbox,
"embedding": image.embedding,
}
for image in section.chunk.images
],
**image_fields,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

**section.content.acls,
}
for section_index, section in enumerate(batch)
]
documents.append(document)
if url:
for document in documents:
document["storageUrl"] = url
Expand Down
Binary file removed data/en_An Occurrence at Owl Creek Bridge.pdf
Binary file not shown.
Loading
Loading