id/indexed-search-autocomplete

索引搜索自动完成

dev-master 2024-01-17 18:27 UTC

This package is auto-updated.

Last update: 2024-09-17 20:04:44 UTC


README

TYPO3 扩展 indexed_search_autocomplete

TYPO3 8 TYPO3 9 TYPO3 10 TYPO3 11 TYPO3 12 Donate Latest Stable Version Monthly Downloads License

扩展了 TYPO3 核心扩展 Indexed_Search 的搜索表单,增加了自动完成功能。

最小依赖

  • TYPO3 CMS 8.7.x - 12.4.x
  • PHP 7.x - 8.x
  • Jquery 1.x

快速安装指南

安装 TYPO3 核心扩展 indexed_search

步骤 1: 该扩展与 TYPO3 核心扩展 indexed_search 兼容。因此,请首先安装和配置此扩展。请检查“词索引”是否正常工作!

步骤 2: 安装此插件。

使用 Composer 安装

安装此扩展的推荐方式是使用 Composer

在基于 Composer 的 TYPO3 项目中运行以下命令

composer require id/indexed-search-autocomplete

从 TYPO3 扩展存储库 (TER) 作为扩展安装

使用扩展管理模块下载并安装 扩展

步骤 3:站点管理 > Typoscript > 编辑整个 Typoscript 记录 > 高级选项 > 包含 Typoscript 集合: Indexed Search Autocomplete (indexed_search_autocomplete) 中包含扩展的静态 TypoScript。

步骤 4: 从 EXT:indexed_search 导出 Partials/Form.html 模板。例如

plugin {
  tx_indexedsearch {
    view {
      templateRootPath = fileadmin/Resources/Plugin/IndexedSearch/Private/Templates/
      partialRootPath = fileadmin/Resources/Plugin/IndexedSearch/Private/Partials/
      layoutRootPath = fileadmin/Resources/Plugin/IndexedSearch/Private/Layouts/
    }
  }
}

步骤 5: 找到包含搜索词文本输入的 fluid 文件 / 代码行。

步骤 6: 将类 'indexed-search-autocomplete-sword' 添加到此文本输入。例如

<f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword indexed-search-autocomplete-sword" />

步骤 7: 现在在想要显示结果的地方添加以下行(大多数情况下在文本输入下方)

TYPO3 8.x - 10.x

<div class="search-autocomplete-results  no-results" data-mode="word" data-searchonclick="false" data-maxresults="10" data-minlength="2" data-searchurl="{f:uri.action(action: 'search', pageType: '7423794', noCache: 1, noCacheHash: 1, extensionName: 'indexedSearchAutocomplete', controller: 'Search')}"></div>

TYPO3 11.x - 12.x

<div class="search-autocomplete-results  no-results" data-mode="word" data-searchonclick="false" data-maxresults="10" data-minlength="2" data-searchurl="{f:uri.action(action: 'search', pageType: '7423794', noCache: 1, extensionName: 'indexedSearchAutocomplete', controller: 'Search')}"></div>

Form.html 示例 TYPO3 v9-10

<div class="tx-indexedsearch-form">
  <label for="tx-indexedsearch-searchbox-sword"><f:translate key="form.searchFor" />:</label>
  <f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword indexed-search-autocomplete-sword" />
  <div class="search-autocomplete-results  no-results" data-mode="word" data-searchonclick="false" data-maxresults="10" data-minlength="2" data-searchurl="{f:uri.action(action: 'search', pageType: '7423794', noCache: 1, noCacheHash: 1, extensionName: 'indexedSearchAutocomplete', controller: 'Search')}"></div>
</div>

Form.html 示例 TYPO3 v11-12

<div class="tx-indexedsearch-form">
  <label for="tx-indexedsearch-searchbox-sword"><f:translate key="form.searchFor" />:</label>
  <f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword indexed-search-autocomplete-sword" />
  <div class="search-autocomplete-results  no-results" data-mode="word" data-searchonclick="false" data-maxresults="10" data-minlength="2" data-searchurl="{f:uri.action(action: 'search', pageType: '7423794', noCache: 1, extensionName: 'indexedSearchAutocomplete', controller: 'Search')}"></div>
</div>

步骤 8: 现在可以使用 <div> 的参数来配置插件选项(见选项)

步骤 9: 在 TYPO3 站点配置中添加新的 PAGE 类型数 7423794,这里是一个示例

routeEnhancers:
  PageTypeSuffix:
   type: PageType
   default: /
   index: ''
   map:
     /: 0
     sitemap.xml: 500001
     autocomplete: 7423794

附加说明: 确保禁用 Indexed-Search 选项“使用 MySQL 特定全文搜索”,否则词建议将无法正常工作。

选项

  • 在扩展设置中启用或禁用 jQuery-Source。(后端 -> 扩展设置) page.includeJSFooterlibs.JquerySource =
  • data-mode="word" => 可能的值有:wordlink。根据您选择的选项,插件将建议您输入单词或链接。您可以在 indexed_search_autocomplete/Resources/Private/Partials/(Fluid)中的两个模板文件中编辑这两个值
  • data-maxresults="10" => 每个建议的条目最大数量(Fluid)
  • data-minlength="2" => 输入字段中必须有多少个字符,插件才会开始第一个建议(Fluid)
  • data-searchonclick="false" => 如果选择了建议,是否应该提交表单(因此基本上在选择了单词后开始搜索)。可能的值是 "false" 或 "true"。

联系 & 沟通

开发人员示例

TYPO3 11: https://t11.baukasten-typo3.de/
TYPO3 12: https://t12.baukasten-typo3.de/

GIT

我们在 github 上
https://github.com/ingeniumdesign/indexed_search_autocomplete/

代理商

INGENIUMDESIGN
TYPO3 - 代理商
65510 Idstein

https://www.ingeniumdesign.de/
info@ingeniumdesign.de

捐赠

亚马逊:https://www.amazon.de/hz/wishlist/ls/13RT2BFNRP05
PayPal:www.paypal.me/INGENIUMDESIGN/

赞助

https://www.ingeniumdesign.de/ - INGENIUMDESIGN
https://www.agenturamwasser.ch/ - Agentur am Wasser GmbH
https://www.baukasten-typo3.de/ - INGENIUMDESIGN
https://www.smallprime.ch/ - Agentur am Wasser GmbH
https://www.takeoffmedia.de/ - Takeoff-Media GmbH
https://ead.darmstadt.de/ - Eigenbetrieb für kommunale Aufgaben und Dienstleistungen (EAD)
https://www.easy-sprachreisen.de/ - Sebastian Ernst & Petra Wagner GbR

下载

TYPO3 TER:https://extensions.typo3.org/extension/indexed_search_autocomplete
Composer:https://packagist.org.cn/packages/id/indexed-search-autocomplete

使用情况

我们正在寻找 Live-Examples 和 TYPO3 indexed_search 自动完成扩展的赞助。
如果您在使用它,请通过电子邮件联系我们。谢谢!

链接/参考文献

https://www.ingeniumdesign.de/ - INGENIUMDESIGN 提供
https://www.baukasten-typo3.de/ - INGENIUMDESIGN 提供
https://www.takeoffmedia.de/ - INGENIUMDESIGN 提供
https://ead.darmstadt.de/ - INGENIUMDESIGN 提供
https://www.easy-sprachreisen.de/ - INGENIUMDESIGN 提供
https://www.radprax.de/ - wilhelm innovative medien GmbH 提供