App
class serves as the abstract foundation for all application types in Superlinked. It provides a unified interface for running executors that can perform operations like data ingestion and query execution across different deployment scenarios.
Constructor
Create a new application instance with the specified configuration.Parameters
The list of data sources that will provide input data to the application.
Sources define how data flows into your vector processing pipeline.
The list of indices that organize your vector spaces for efficient querying.
Each index represents a collection of related vector spaces.
The vector database instance that the executor will use for storing and
retrieving vector data. This determines where your vectors are persisted.
The execution context that provides configuration and runtime information for
the application.
Whether to initialize search indices during application startup. Set to
True
for production deployments.Example
The
App
class is abstract and cannot be instantiated directly. Use concrete
implementations like InMemoryApp
, RestApp
, or OnlineApp
.Properties
storage_manager
StorageManager
- The storage manager instance used by this application.
Inheritance Hierarchy
TheApp
class serves as the base for specialized application types:
Concrete App Types
Concrete App Types
- InMemoryApp - For development and testing with in-memory storage - RestApp - For production REST API deployments - OnlineApp - For real-time online processing - InteractiveApp - For interactive development environments
Application Lifecycle
Initialization Phase
- Source Setup: Data sources are configured and connected
- Index Preparation: Vector indices are created and optimized
- Database Connection: Vector database connection is established
- Context Loading: Execution context and configuration are applied
Runtime Phase
- Data Ingestion: Sources provide data that flows through the processing pipeline
- Vector Processing: Data is transformed into vectors using defined spaces
- Storage Operations: Vectors are stored in the configured vector database
- Query Handling: Search and retrieval operations are executed against the stored vectors
Design Patterns
Builder Pattern
Apps are typically created using executor builders for clean configuration:Strategy Pattern
Different app types implement the same interface but with different execution strategies:- InMemoryApp: In-memory processing for development
- RestApp: HTTP API-based processing for production
- OnlineApp: Real-time streaming processing
Best Practices
App Selection: Choose the appropriate app type based on your deployment
needs. Use
InMemoryApp
for development, RestApp
for API services, and
OnlineApp
for real-time processing.Resource Management: Ensure proper cleanup of resources when shutting down
applications, especially database connections and file handles.
Thread Safety: App instances are designed for single-threaded use. For
concurrent access, use appropriate synchronization mechanisms or multiple app
instances.
Configuration: The execution context provides important configuration
details. Ensure it’s properly configured before initializing your app.