ai-cfia / ai-cfia/azure-db

Handle Dynamic Highlight Fields Transformation in azure-db

Abierto
#9 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
0
Forks
1
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

The current implementation of `transform_result` in our Azure Cognitive Search integration is hardcoded to search for "content" in `@search.highlights`. This approach is not flexible and fails to handle cases where `highlight_fields` is set to other fields or is `None`. We need to refactor this function to dynamically handle different `highlight_fields` and gracefully handle situations where `highlight_fields` is `None` (i.e., highlighting is not used).

## Tasks
- [ ] Modify `transform_result` to dynamically check for highlighted content based on the fields specified in `highlight_fields`.
- [ ] Implement a check in `transform_result` to bypass looking in `@search.highlights` when `highlight_fields` is `None`.
- [ ] Ensure that the original content of a field is used when its highlights are not available or when `highlight_fields` is `None`.
- [ ] Add support for handling multiple fields in `highlight_fields`.
- [ ] Write unit tests to cover various scenarios, including:
- `highlight_fields` set to different fields (other than "content").
- `highlight_fields` set to `None`.
- Multiple fields specified in `highlight_fields`.
- Absence of expected highlights in search results.

## Acceptance Criteria
- The `transform_result` function should dynamically handle the fields specified in `highlight_fields`, returning highlighted content appropriately.
- When `highlight_fields` is `None`, the function should not attempt to access `@search.highlights` and should use the original field content.
- The function must handle multiple highlight fields correctly, ensuring consistent results across different configurations.
- The solution must be robust, handling all specified edge cases, with unit tests confirming the expected behavior.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.