【问题标题】:TYPO3 Indexed Search not workingTYPO3 索引搜索不起作用
【发布时间】:2017-01-19 12:26:25
【问题描述】:

我使用的是 TYPO3 版本 8,我已经安装了带有打字稿的 indexed_search 表单框

50 = COA
50 {
    stdWrap {
        wrap = <div id="searchcontainer">|</div><div class="clearboth"></div>
        required = 1
    }

    10 = TEXT
    10 {
        wrap = <form id="searchbox" name="searchbox" action="|" method="post">
        typolink.parameter = {$searchPID}
        typolink.returnLast = url

        if.isTrue = {$config.tx_realurl_enable}
    }

    20 = TEXT
    20 {
        value = <form id="searchbox" name="searchbox" action="/" method="post">
        if.isFalse = {$config.tx_realurl_enable}
    }

    30 = COA
    30 {
        10 = TEXT
        10{
            wrap = <input type="hidden" name="id" value="|" />
            value = {$searchPID}
            if.isFalse = {$config.tx_realurl_enable}
        }

        20 = TEXT
        20 {
            wrap = <input type="text" id="swords" name="swords" value="|" size="20" onfocus="this.value='';" />
            value = {$searchTEXT}
        }

        30 = TEXT
        30 {
            wrap = <input type="submit" id="searchbutton" value="" />
        }
    }

    40 = TEXT
    40 {
        value = </form>
    }
}

当我点击搜索时,我被重定向到包含已安装搜索插件的搜索页面,但没有显示搜索结果甚至关键字。页面索引良好,并且在后端索引搜索关键字中出现,但不在前端,我在这里错过了什么?请帮忙!

【问题讨论】:

    标签: search typo3


    【解决方案1】:

    user2714261 展示了如何禁用所有元素的 cHash 检查。这实际上可能有点冒险。但是您只能为 indexed_search 插件停用它。这不会有任何问题,因为 indexed_search 无论如何都不应该缓存。所以你可以在你的插件设置中写:

    plugin {
        tx_indexedsearch {
            features.requireCHashArgumentForActionArguments = 0
        }
    }
    

    这在 TYPO3 8.7.9 中运行良好。

    马丁

    【讨论】:

      【解决方案2】:

      您可以在 FLUIDTEMPLATE 中使用&lt;f:form&gt; 来生成快速搜索表单。这样,一个基本的 cHash 参数将自动生成并附加到操作 URL。

      TypoScript(常量)

      plugin.tx_indexedsearch.settings.targetPid = 35
      

      TypoScript(设置)

      lib.quicksearch = FLUIDTEMPLATE
      lib.quicksearch{
          file = fileadmin/Quicksearch.html
          settings.targetPid = {$plugin.tx_indexedsearch.settings.targetPid}
      }
      

      快速搜索.html

      <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
      <div id="quicksearch">
          <f:form action="search" method="post" controller="Search" extensionName="indexedsearch" pluginName="pi2" pageUid="{settings.targetPid}">
              <f:form.textfield name="search[sword]" value="{sword}" class="quicksearch-sword" />
              <f:form.submit name="search[submitButton]" value="Search" class="quicksearch-submit" />
          </f:form>
      </div>
      </html>
      

      【讨论】:

        【解决方案3】:

        编辑:我找到了解决方案。您必须在拼写链接 ts 中添加一些内容(我的结果插件有 _pi2 btw)

                wrap = <form id="searchbox" name="searchbox" action="|" method="post">
            typolink.parameter = 25  
            typolink.additionalParams = &tx_indexedsearch_pi2[action]=search&tx_indexedsearch_pi2[controller]=Search  
            typolink.returnLast = url
            typolink.useCacheHash = 1
        

        第一次发帖:

        我现在没有解决方案,但我找到了一些可以提供帮助的方法。

        我在使用 TYPO3 8 和搜索框时遇到了类似的问题。我调整了搜索框的 HTML,使其适合嵌入式插件,如下所示:

        <form action="searchresult.html?tx_indexedsearch_pi2%5Baction%5D=search&amp;tx_indexedsearch_pi2%5Bcontroller%5D=Search" method="post" name="searchform" id="searchform">
          <input name="tx_indexedsearch_pi2[search][sword]" type="text"/>
          <input name="tx_indexedsearch_pi2[search][submitButton]" type="submit" id="submitbutton" value="submit"/> 
        ...
        

        如您所见,我的模板中有一个固定设置。我注意到的是,如果您不在操作 url 中发送 chash,嵌入式插件显然不会运行。可能你可以用你的打字稿来生成它。

        我只是确定这是问题所在,至少对我来说是这样,因为当我关闭 extbase 的 chash 要求时,它可以工作...

        config.tx_extbase.features.requireCHashArgumentForActionArguments = 0
        

        但我认为这有点冒险,不应该在生产中使用

        所以生成 chash 应该是让它工作的方法。只是想分享我的发现。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-03-08
          • 2017-09-23
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多