TYPO3 Indexed Search not working

久未见 提交于 2020-01-05 07:51:49

问题


I'm using the TYPO3 version 8, I have installed the indexed_search form box with typoscript

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>
    }
}

When I click on search, I'm redirected to my search page wich contain the search plugin installed, but no search results or even the keyword is showing. The pages are well indexed and in the backend indexing searched keyword it appears, but not in the frontend, what I'm mising here ? please help!


回答1:


Edit: i found the solution. You have to add something to the typolink ts (my result plugin has _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

First Posting:

I don't have the solution right now, but i found something that could help.

I'm having a similar problem with TYPO3 8 and a searchbox. I adapted my HTML of the searchbox, that it fits to the embedded plugin, like this:

<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"/> 
...

As you can see i have a fixed setup here in my template. What i noticed is, that the embedded plugin obviously doesn't run if you don't send the chash in the action url. Probably you can generate it with your typoscript.

I'm just sure that this is the problem, at least for my case, because when i turn the chash requirements for extbase off, it works ...

config.tx_extbase.features.requireCHashArgumentForActionArguments = 0

but i believe that is a little bit risky and should not be used in production

so generating the chash should be the way to do make it work. just wanted to share what i found out.




回答2:


You can use <f:form> in a FLUIDTEMPLATE to generate a Quicksearch-Form. This way an essential cHash-parameter will be generated and appended to the action-URL, automatically.

TypoScript (Constants)

plugin.tx_indexedsearch.settings.targetPid = 35

TypoScript (Setup)

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

Quicksearch.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:


user2714261 shows, how to deactivate the cHash check for all elements. That might a bit risky in deed. But you can deactive it only for the indexed_search plugin. That won't be any problem, because the indexed_search should not cache anyway. So you jsut can write in your plugin-Setup:

plugin {
    tx_indexedsearch {
        features.requireCHashArgumentForActionArguments = 0
    }
}

That worked fine in TYPO3 8.7.9.

Martin



来源:https://stackoverflow.com/questions/41741790/typo3-indexed-search-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!