Skip to content

codelibs/fess-site-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fess Site Search Generator

CI/CD Pipeline License Python Node

Fess Site Search (FSS) is a customizable JavaScript widget generator that enables you to easily embed powerful search functionality on your website, powered by the Fess search engine.

🌟 Features

  • Visual Customization Wizard: Interactive web interface for customizing colors, fonts, and layout
  • Advanced CSS Support: Upload custom CSS files for fine-grained control
  • Live Preview: See your search widget in action before deployment
  • Multi-language: Support for English and Japanese
  • Vue.js Components: Modern, responsive search interface built with Vue 3
  • Easy Integration: Just one JavaScript file to embed on your site

πŸš€ Quick Start

Try It Online

Visit FSS Generator to create your customized search widget instantly.

Run with Docker

The fastest way to get started:

# Build the Docker image
docker build -t fss .

# Run the container
docker run -d -p 5000:5000 fss

# Access the application
open http://localhost:5000

Local Development Setup

Prerequisites

Installation

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/codelibs/fess-site-search.git
cd fess-site-search

# Run the installation script
chmod +x install.sh
./install.sh

Running the Development Server

# Set Flask environment variable
export FLASK_APP=app/__init__.py

# Run with uv
uv run flask run

# Or activate the virtual environment first
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
flask run

The application will be available at http://localhost:5000.

πŸ“– Usage

Generating a Custom Search Widget

  1. Configure Your Fess Server

    • Enter your Fess server URL (e.g., https://search.example.com)
  2. Customize Appearance

    • Choose theme colors (background, text, links, borders)
    • Select font family
    • Or upload a custom CSS file
  3. Generate Widget

    • Click "Generate" to create your customized JavaScript file
    • Preview the search widget with sample queries
  4. Deploy to Your Site

    • Download the generated fess-ss-{hash}.min.js file
    • Add it to your website:
<!DOCTYPE html>
<html>
<head>
    <title>My Website</title>
</head>
<body>
    <!-- Your content here -->

    <!-- Fess Site Search Widget -->
    <div id="fess-search"></div>
    <script src="path/to/fess-ss-{hash}.min.js"></script>
</body>
</html>

πŸ› οΈ Development

Project Structure

fess-site-search/
β”œβ”€β”€ app/                    # Flask backend application
β”‚   β”œβ”€β”€ views.py           # HTTP route handlers
β”‚   β”œβ”€β”€ backend.py         # Form processing and build orchestration
β”‚   β”œβ”€β”€ build_manager.py   # Concurrent build process manager
β”‚   β”œβ”€β”€ static/            # Static assets (CSS, JS, images)
β”‚   └── templates/         # Jinja2 HTML templates
β”œβ”€β”€ fss/                   # Vue.js frontend application
β”‚   β”œβ”€β”€ src/               # Vue components and source code
β”‚   β”œβ”€β”€ public/            # Public assets
β”‚   └── package.json       # Node.js dependencies
β”œβ”€β”€ tests/                 # Test suite
β”œβ”€β”€ pyproject.toml         # Python project configuration
β”œβ”€β”€ Dockerfile             # Docker container definition
└── install.sh             # Installation script

Available Commands

Python/Backend

# Install dependencies
uv sync --all-extras

# Run Flask development server
uv run flask run

# Run tests
uv run pytest -v

# Run linter
uv run ruff check app/ tests/

# Format code
uv run ruff format app/ tests/

Node.js/Frontend

cd fss/

# Install dependencies
npm install

# Development server with hot-reload
npm run serve

# Build for production
npm run build

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

Running Tests

# Run all tests (excluding slow webpack build tests)
uv run pytest -v -m "not slow"

# Run all tests including slow tests (requires Flask server)
uv run pytest -v

# Run only slow tests (webpack build tests)
uv run pytest -v -m "slow"

# Run specific test file
uv run pytest tests/test_status.py -v

Test Categories:

  • Fast tests (not slow): Basic Flask routes and functionality (~5 seconds)
  • Slow tests (slow): Dynamic webpack builds and uploads (~30-120 seconds)

Note: Slow tests require a running Flask server and may take several minutes in CI environments.

Building for Production

Docker Image

# Build optimized production image
docker build -t fss:latest .

# Run in production mode
docker run -d \
  -p 5000:5000 \
  -e APP_WEBPACK_LIMIT=4 \
  --name fss-prod \
  fss:latest

Manual Build

# Build frontend
cd fss/
npm run build

# Copy to Flask static directory
mkdir -p ../app/static/fss
cp dist/fess-ss.js ../app/static/fss/

# Run with Gunicorn
cd ..
uv run gunicorn app:app \
  -b 0.0.0.0:5000 \
  -w 4 \
  --threads 12 \
  --preload

πŸ”§ Configuration

Environment Variables

Variable Description Default
FLASK_APP Flask application entry point app/__init__.py
FLASK_ENV Flask environment (development/production) production
APP_WEBPACK_LIMIT Maximum concurrent webpack builds 2

Build Configuration

The application supports concurrent build processes with semaphore-based throttling. Adjust APP_WEBPACK_LIMIT based on your server resources:

  • Small instances (1-2 CPU cores): APP_WEBPACK_LIMIT=2
  • Medium instances (4-8 CPU cores): APP_WEBPACK_LIMIT=4
  • Large instances (8+ CPU cores): APP_WEBPACK_LIMIT=8

πŸ“š Documentation

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (uv run pytest -v)
  5. Run linter (uv run ruff check . && uv run ruff format .)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

πŸ› Bug Reports

If you find a bug, please create an issue on GitHub Issues with:

  • Clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Environment details (OS, Python version, Node.js version)

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Fess: Powerful enterprise search engine
  • Vue.js: Progressive JavaScript framework
  • Flask: Lightweight web framework

πŸ“ž Support


Made with ❀️ by CodeLibs Project

Releases

No releases published

Packages

No packages published

Contributors 10