Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

81 Commits

Folders and files

Repository files navigation

Solr Multicore

A Docker-based Solr 9 setup with Plone-specific configuration and comprehensive pytest testing infrastructure.

Features

  • Solr 9: Latest stable version with modern Point field types
  • Solr Schemas: Solr schemas for Plone, Google Drive, Confluence, Nextcloud, and SharePoint
  • Docker Compose: Easy container management with persistent volumes
  • Web UI: Web User Interface for search both across all Solr cores as well as in individual Solr cores
  • Pytest Integration: Comprehensive testing framework with fixtures
  • Makefile: Convenient commands for common operations

Supported Platforms

Quick Start

Prerequisites

  • Docker and Docker Compose
  • Python 3.8+ (for testing)
  • Make

Start Solr

make up

This will start Solr (via Docker Compose) with multiple cores preconfigured at http://localhost:8983/solr/:

  • confluence - Confluence CMS content
  • gdrive - Google Drive content
  • nextcloud - Nextcloud content
  • plone - Plone CMS content
  • sharepoint - SharePoint content
  • all_content- Unified search core with all the content from the individual systems

Configure Connectors

Configure Confluence

Check README_CONFLUENCE.md

Configure Google Drive

Check README_GOOGLE_DRIVE.md

Configure Nextcloud

Check README_NEXTCLOUD.md

Configure Plone

Check README_PLONE.md

Configure SharePoint

Sync the Solr indexes

You can sync all Solr cores with:

make sync-all

Individual cores can be synced with:

make sync-confluence
make sync-gdrive
make sync-nextcloud
make sync-plone
make sync-sharepoint

Sync Google Drive Data

  • make reindex-gdrive-decoupled

Decoupled Operations

  • make index-gdrive-metadata (~20k documents in 18 min)
  • make download-gdrive-files (~2500 files in 5h + 22 min)
  • make process-cached-files (~2765 files 20 min)

Create Google OAuth Credentials

Create Google Service Account

  1. Create a Service Account in Google Cloud Console (https://console.cloud.google.com/):
    • Go to IAM & Admin → Service Accounts
    • Create a new service account
    • Download the JSON key file
  2. Enable Domain-wide Delegation (if accessing organization files):
    • In the service account settings, enable "Domain-wide delegation"
    • Note the client ID (101005515020586861973)
  3. Grant Drive API Access (for organization):
  4. Share Drive Files/Folders:
    • Share specific files/folders with the service account email
    • Or use domain-wide delegation for organization-wide access

Test Connectivity

make test

View Core Status

make core-status

Unified Search

The system supports unified search across multiple content sources using the content_source field to distinguish between different systems:

Search Across All Content Sources

# Search all content for "project"
curl "http://localhost:8983/solr/gdrive/select?q=Title:project"

# Search only Plone content
curl "http://localhost:8983/solr/gdrive/select?q=content_source:plone AND Title:project"

# Search only Google Drive content
curl "http://localhost:8983/solr/gdrive/select?q=content_source:google_drive AND Title:project"

Content Source Values

  • plone - Content from Plone CMS
  • google_drive - Content from Google Drive
  • confluence - Content from Confluence

Testing

Install Test Dependencies

make install-test-deps

Run Tests

# Run all tests
make test-all

# Run only unit tests
make test-unit

# Run only integration tests
make test-integration

# Run tests with coverage
make test-cov

# Run tests in parallel
make test-parallel

Test Structure

  • tests/conftest.py - Pytest fixtures and configuration
  • tests/test_basic_functionality.py - Basic Solr operations
  • tests/test_plone_specific.py - Plone-specific field tests

Test Fixtures

  • solr_docker - Session-scoped Docker container management
  • solr_client - Function-scoped clean Solr client
  • sample_documents - Sample test documents
  • populated_solr - Pre-populated Solr instance

Project Structure

├── configsets/                     # Solr core configurations
│   ├── confluence/
│   │   └── conf/
│   │       ├── schema.xml          # Confluence field definitions
│   │       ├── solrconfig.xml      # Solr configuration
│   │       └── ...
│   ├── gdrive/
│   │   └── conf/
│   │       ├── schema.xml          # Google Drive field definitions
│   │       ├── solrconfig.xml      # Solr configuration
│   │       └── ...
│   ├── nextcloud/
│   │   └── conf/
│   │       ├── schema.xml          # Nextcloud field definitions
│   │       ├── solrconfig.xml      # Solr configuration
│   │       └── ...
│   ├── plone/
│   │   └── conf/
│   │       ├── schema.xml          # Plone field definitions
│   │       ├── solrconfig.xml      # Solr configuration
│   │       └── ...
│   └── sharepoint/
│       └── conf/
│           ├── schema.xml          # SharePoint field definitions
│           ├── solrconfig.xml      # Solr configuration
│           └── ...
├── connectors/                     # Data connectors and configuration
│   ├── confluence_connector.py     # Confluence sync connector
│   ├── gdrive_connector.py         # Google Drive sync connector
│   ├── nextcloud_connector.py      # Nextcloud sync connector
│   ├── plone_connector.py          # Plone sync connector
│   ├── sharepoint_connector.py     # SharePoint sync connector
│   ├── credentials_confluence.json.example # Confluence config template
│   ├── credentials_gdrive.json.example     # Google Drive config template
│   ├── credentials_nextcloud.json.example  # Nextcloud config template
│   ├── credentials_plone.json.example      # Plone config template
│   ├── credentials_sharepoint.json.example # SharePoint config template
│   ├── requirements.txt            # Python dependencies
│   ├── requirements-confluence.txt # Confluence specific dependencies
│   ├── requirements-sharepoint.txt # SharePoint specific dependencies
│   └── ...
├── web-ui/                         # Web search interface
│   ├── app.js                      # Search application
│   ├── index.html                  # Web interface
│   └── styles.css                  # Interface styling
├── tests/                          # Test suite
│   ├── conftest.py                 # Pytest configuration
│   ├── test_basic_functionality.py # Basic tests
│   └── test_plone_specific.py      # Plone-specific tests
├── README_CONFLUENCE.md            # Confluence setup guide
├── README_GOOGLE_DRIVE.md          # Google Drive setup guide
├── README_NEXTCLOUD.md             # Nextcloud setup guide
├── README_PLONE.md                 # Plone setup guide
├── docker-compose.yml              # Docker services
├── Makefile                        # Common commands
├── pyproject.toml                  # Python project config
└── requirements-test.txt           # Test dependencies

Available Commands

Docker Management

  • make up - Start Solr services
  • make down - Stop Solr services
  • make logs - View Solr logs
  • make clean - Clean Docker resources

Solr Operations

  • make test - Test Solr connectivity
  • make core-status - Check core status
  • make query-test - Test basic query
  • make post-data - Post test document
  • make reload-core - Reload core configuration

Testing

  • make install-test-deps - Install test dependencies
  • make test-unit - Run unit tests
  • make test-integration - Run integration tests
  • make test-all - Run all tests
  • make test-cov - Run tests with coverage
  • make test-parallel - Run tests in parallel

Schema Fields

This project supports multiple Solr cores with unified search capabilities across different content sources.

Essential Search Fields

These are the most important fields for search operations across all cores:

  • id - Unique document identifier (required for all documents)
  • UID - Content-specific unique identifier (Plone UID, Google Drive file ID)
  • Title - Document title/name (primary display field)
  • Description - Document description/summary (searchable text)
  • body_text - Full extracted text content (main search field)
  • content_source - Source system identifier (plone, google_drive, confluence, sharepoint etc.)

Core Fields

  • SearchableText - Full-text search field (copy field from multiple sources)
  • portal_type - Content type
  • review_state - Workflow state
  • Subject - Multi-value tags/keywords
  • allowedRolesAndUsers - Security permissions

Path and Metadata Fields

  • path_string, path_parents, path_depth - Path information
  • created, modified, effective, expires - Date fields
  • mime_type, mime_category - File type information
  • size - File size in bytes

Boolean Fields

  • is_folderish - Folder indicator
  • exclude_from_nav - Navigation exclusion
  • showinsearch - Search visibility
  • shared, starred, trashed - Google Drive specific flags

Google Drive Specific Fields

  • owners - File owners (multi-value)
  • parents - Parent folder IDs (multi-value)
  • web_view_link - Direct link to view file
  • file_extension - File extension (pdf, docx, etc.)
  • sync_timestamp, sync_status - Synchronization metadata

Development

This setup follows official Solr Docker best practices and pytest-solr patterns for robust testing infrastructure.

Adding New Tests

  1. Create test files in tests/ directory
  2. Use provided fixtures from conftest.py
  3. Mark tests with @pytest.mark.unit or @pytest.mark.integration
  4. Follow existing patterns for Solr client usage

Customizing Schema

  1. Edit configsets/plone/conf/schema.xml
  2. Reload core: make reload-core
  3. Update tests as needed

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages