定制 adrexia/staticsearch 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

adrexia/staticsearch

Composer 安装命令:

composer require adrexia/staticsearch

包简介

Static Search provides an alternative search option to statically published silverstripe sites

README 文档

README

An implementation of Tipue search designed to work in SilverStripe with the Static Publish Queue module. This implementation uses the static mode of Tipue search.

This module works with:

  • subsites (optional)
  • static publish queue (mandatory)

Approach

  • Extension to SiteTree to add methods that generate data for searchable fields. These can be overridden at Page level if necessary.
  • Build Task to generate json index files for each subsite (stored in the cache directory).
  • Basic implementation of Tipue JavaScript search, in static mode.
  • Search page controller to hold results of search (filled in by JavaScript search)

JSON Format:

{  
     "title": "page title",  
     "text":"Prepped page content",  
     "tags":"Taxonomy or meta description",  
     "loc":"Page URL"  
}

Set-up

Get the code

Add this to your composer.json file:

"adrexia/staticsearch": "dev-master"

Update your repo:

composer update

Integration

Add the search form to your page:

<% include StaticSearchForm %>

Include StaticSearchRequirements in the head of your page.

<% include StaticSearchRequirements %>

If you like, copy StaticSearchRequirements.ss to your theme, and override with any customized files. These files are only needed for the search page itself. Read the Tipue docs if you experience any issues with the search itself. It can be a bit particular about its set up.

http://www.tipue.com/search/docs/

If you want to make the searchpage fit your site design, copy SearchPage.ss to your theme folder. There is base css provided in staticsearch/css/tipuesearch.css. You can use this as is, or replace with your own css.

Customization of results

Methods generating the data for the json files live in staticsearch/code/extensions/StaticSearchSiteTreeExtension.php. You can override these methods at Page level (e.g. in Page.php). You may wish to have a smaller range of data appear, or you might want to index data objects as content on a page.

These methods can be overridden at Page level. It is suggested that if you are working with larger statically published sites, you use the tagging system (see getSearchableTags()) as the main search mechanism, and limit the content block to a simple abstract.

Generate results

Run the BuildStaticSearchIndexTask to generate the search_index.json files (note, the static publish queue tasks must have been run at least once to generate the cache itself).

dev/tasks/BuildStaticSearchIndexTask

You probably want to set this task up to run once a day on your live site to update the search index.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固