empiricompany/openmage-search 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

empiricompany/openmage-search

最新稳定版本:1.0.0

Composer 安装命令:

composer require empiricompany/openmage-search

包简介

Advanced search module for OpenMage using Typesense

README 文档

README

Advanced search module for OpenMage using Typesense as search engine and instantsearch.js for frontend.

Overview

instantsearch

MM Search is a module that replaces the default search engine in OpenMage with Typesense, a fast and typo-tolerant search engine. This module provides:

  • Instant search with autocomplete
  • Faceted search
  • Typo tolerance
  • Fast and relevant search results
  • Easy configuration

Requirements

  • OpenMage LTS 19.x or higher
  • PHP 7.4 or higher
  • Typesense server (self-hosted or cloud)

docker-compose.yml example for self-host a TypeSense instance with a dashboard

services:
  typesense:
    image: typesense/typesense:27.1
    ports:
      - "8108:8108"
    environment:
      TYPESENSE_DATA_DIR: /data
      TYPESENSE_API_KEY: S3CR3T
      TYPESENSE_API_ALLOW_ORIGINS: "*"
    healthcheck:
      test: ["CMD-SHELL", "exit 0"]
      interval: 5s
      timeout: 5s
      retries: 20
    volumes:
      - typesense-data:/data

  typesense-dashboard:
    image: bfritscher/typesense-dashboard
    ports:
      - "5002:80"  # Puoi cambiare la porta se necessario
    environment:
      TYPESENSE_API_URL: "http://typesense:8108"  
      TYPESENSE_API_KEY: "S3CR3T"
    depends_on:
      - typesense
    restart: always

volumes:
  typesense-data:

Installation

Via Composer

composer require empiricompany/openmage-search

This will automatically install the latest stable version of the module.

Configuration

  1. Go to System > Configuration > MM Search
  2. Enable the module
  3. Configure the Typesense connection settings:
    • Admin API Key
    • Search-Only API Key
    • Host
    • Port
    • Protocol
    • Path
    • Collection Name
  4. Save the configuration

Indexing

This module completely replaces the default search engine in OpenMage with Typesense. When products are indexed, they are automatically added to Typesense.

To rebuild the index:

  1. Go to System > Index Management
  2. Select "Catalog Search Index"
  3. Choose "Reindex Data" from the actions dropdown
  4. Click "Submit"

Features

Instant Search

The module replaces the default search box with an instantsearch.js interface that shows results as you type.

Faceted Search

Users can filter search results by:

  • Categories
  • Manufacturers
  • Price range and other attributes with "Use In Search Results Layered Navigation": Yes

Typo Tolerance

Typesense's typo tolerance ensures that users find what they're looking for even if they make typos.

Customization

Templates

You can customize the search interface by modifying the following templates:

  • app/design/frontend/base/default/template/mm/search/instantsearch.phtml

CSS

You can customize the appearance by modifying the CSS files:

  • skin/frontend/base/default/css/mm_search/instantsearch.css

JavaScript

You can customize the behavior by modifying the JavaScript file:

  • skin/frontend/base/default/js/mm_search/instantsearch-custom.js

Troubleshooting

Common Issues

  1. Connection Failed: Make sure your Typesense server is running and accessible from your OpenMage server.
  2. No Results: Check if the products are properly indexed in Typesense. Try rebuilding the Catalog Search Index.
  3. JavaScript Errors: Check the browser console for any JavaScript errors.

License

This module is licensed under the MIT License.

统计信息

  • 总下载量: 115
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: CSS

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-18