Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search presets support #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tharropoulos
Copy link
Contributor

Change Summary

This enhancement adds support for managing search presets in the Typesense Java client.

Rationale

By implementing search presets management, users can:

  • Store and reuse common search configurations
  • Maintain consistent search experiences across different parts of their application
  • Easily manage search presets through a clean API interface

Changes

Added Features:

  1. New Class Presets.java:

    • upsert(): Creates or updates a search preset with specified name
    • retrieve(): Gets all available search presets
    • Base endpoint management for preset operations
  2. New Class Preset.java:

    • retrieve(): Gets details of a specific search preset
    • delete(): Removes a search preset
    • Individual preset management functionality
  3. Client Integration in Client.java:

    • presets(): New method providing access to global preset operations
    • presets(String presetId): Method for accessing individual preset operations
    • Added proper instance management for presets functionality

Code Changes:

  1. In Client.java:
    • Added presets management instance variables
    • Implemented presets access methods
    • Added initialization in constructor

Documentation Updates:

  1. In README.md:
    • Added code examples for all preset operations:
      • Creating/updating a search preset
      • Retrieving individual and all presets
      • Deleting presets
    • Clear usage examples with realistic search configurations

Test Coverage:

  1. New Test Class PresetsTest.java:

    • Comprehensive test coverage for all preset operations
    • Tests for upsert, retrieve, retrieve all, and delete operations
    • Proper setup and teardown handling
  2. Updates to Helper.java:

    • Added presets support in test utilities
    • Implemented cleanup for presets in teardown

Context

This implementation aligns with Typesense's search presets API endpoints and provides a Java-friendly interface for managing search configurations. The changes follow existing patterns in the client library for consistency and ease of use. All operations are properly tested and documented to ensure reliability and maintainability.

PR Checklist

Implements search presets management to allow storing and reusing common search
configurations. Adds complete CRUD operations for search presets with proper
error handling and test coverage.

Changes include:
- New Presets and Preset classes for managing search presets
- Full test coverage with realistic search preset scenarios
- Helper class updates for testing preset functionality
- Documentation updates with usage examples for common scenarios

feat(presets): add Presets class for bulk operations
feat(presets): add Preset class for individual preset management
test(presets): add PresetsTest test coverage
refactor(helper): add presets support in test helper
docs(presets): add documentation and examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant