algoliasearch-django
                                
                                 algoliasearch-django copied to clipboard
                                
                                    algoliasearch-django copied to clipboard
                            
                            
                            
                        feat: adding save records endpoint
| Q | A | 
|---|---|
| Bug fix? | no | 
| New feature? | yes | 
| BC breaks? | no | 
| Related Issue | Fix https://github.com/algolia/algoliasearch-client-python/issues/561 | 
| Need Doc update | yes | 
Describe your change
The provided change introduces an optimized solution for updating specific records within the Algolia search index efficiently. It addresses the challenges faced when dealing with a large number of products that require periodic updates.
What problem is this fixing?
The initial problem involved the impracticality of individually indexing a potentially large number of products, resulting in excessive API requests and a time-consuming process. The proposed solution introduces a save_records method that efficiently handles batch updates for specific products, streamlining the indexing process.
Key Changes Made:
- 
The save_recordsmethod has been added to handle batch updates for specific records in the Algolia index. This method efficiently processes records in batches, improving the overall time and resource utilization.
- 
The method utilizes a temporary index ( __tmp_index) for storing and processing the updated records in batches.
- 
Records that should not be indexed are marked for deletion, ensuring the removal of outdated records from the index. 
The delete_records method has been introduced to handle the deletion of multiple records from the Algolia index.
Impact and Benefits:
- The proposed solution significantly reduces the time and resources required for updating a subset of records within the index.
- Enhances the overall user experience, particularly in scenarios where only specific products within a collection need updating.
- The batch processing approach improves efficiency and reduces the number of API calls, making it a more scalable solution.
The changes provide a more streamlined and efficient workflow for handling periodic updates, addressing the outlined challenges. This enhancement contributes to a more responsive and user-friendly Algolia integration.
Additional Notes:
With limited experience in the codebase, I thoroughly explored the repository before proposing this solution. While I acknowledge the potential for oversight, I aimed to provide a preliminary solution and showcase a possible approach. Feedback and corrections are welcomed as opportunities for learning and improvement. Thank you for your guidance.
Please review the changes and provide feedback on the proposed solution.