Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resultlist not using Storage Page from Searchbox #142

Closed
Atomschinken opened this issue Jan 18, 2023 · 7 comments
Closed

Resultlist not using Storage Page from Searchbox #142

Atomschinken opened this issue Jan 18, 2023 · 7 comments

Comments

@Atomschinken
Copy link

Environment:
TYPO3 11.5.22
ke_search 4.6.0
PHP 8.1

The Resultlist is only inheriting the flexform configuration from the Searchbox but not the Storage Page (field "pages").
This leads to some strange behaviour:
Choosing a hidden filter and preselected option with no results, the Resultlist does not show anything, not even the configured "No results"-Text. As it is not using the Storage Page from the Searchbox it assumes an empty search and tries to render the result list template.
Expected behaviour IMO should be that the "No result"-text is displayed in this case.

It works if you fill the pages field for the Resultlist in the database directly or remove pages from the subtypes_excludelist to fill it manually.
A better solution could be to use the Storage Page from the Searchbox.

@christianbltr christianbltr added the question Further information is requested label Feb 3, 2023
@christianbltr
Copy link
Member

christianbltr commented Feb 3, 2023

I could not reproduce the described issue. I tried it by using a filter option for a hidden filter which gives an empty result set.

Also the storage page (in the code the variable $startingPointsis used) is fetched from the searchbox plugin.

That is done in

$this->startingPoints = $this->div->getStartingPoint();

which calls

public function getStartingPoint()

to fetch the starting point from the searchbox plugin.

Could you check if something else is causing your issue that you don't see the "no results" message?

@vmans
Copy link

vmans commented Feb 20, 2023

Environment:
TYPO3 11.5.24
ke_search 4.6.3
PHP 8.0

I have basically the same issue. In my case I have several storage folders (e.g. one for recipes, one for news, one for products). The indexing goes well, the content is stored in the correct storage folder.

But the search seems to fetch the content from all the storage folders, not respecting the startingpoint that's set per searchbox.

Additionally: Recipes and news are all news items in this case, spread over different storage folders. They get mixed up in the search result, despite the setting of the storagefolder. For the other items (cart, pages) I can't tell at this moment.

Before updating this website (from 10LTS and a version 4.x of ke_search) it went well.

(I checked the option var/log but to view the query no entries are logged)

@christianbltr
Copy link
Member

I could not reproduce this issue also. I have two sysfolders with different indexer configurations. One indexes news and one indexes pages. Both store their results in their sysfolder, so they are separated. When I set the "Record Storage Page" in the search box plugin configuration to one of the sysfolders, only the result from that sysfolder are shown, as expected.

I assume that it is some kind of misconfiguration which leads to the unwanted behaviour. Maybe you could add some more information about your configuration setup?

Also, do you have more than one search box on the result page? That could lead to problems also.

@Hawkeye1909
Copy link

Environment:
TYPO3 11.5.30
ke_search 5.0.3
PHP 8.0

Hi! I experienced the same issue as @Atomschinken, but in a different situation: I want to list the filters in the result list as described here. The filters are shown in the searchbox but in the result list the variable is NULL. This changes if I add the page uid in the field 'pages' in tt_content for the result list element...

The problem is that 'loadFlexformsFromOtherCE' is not set in the conf array (here). And this is ironically caused by the function it should provide... I don't know exactly how it got there (maybe I created it as result list first) but the flexbox configuration of the searchbox also has the field 'loadFlexformsFromOtherCE', but it is empty. So when you merge the two configurations, the value is cleared and getStartingPoint fails. This behavior of the flexforms is long known and considered as a bug by some people and a feature by others (see e.g. here).

I can think of two possible solutions:

  1. save the value of $flexFormConfiguration['loadFlexformsFromOtherCE'] before merging the configurations and reset it afterwards.
  2. rename the sheet 'MAIN' in flexform_resultlist.xml to be different from flexform_searchbox.xml (or vice versa) and retrieve only the configuration needed for the current plugin.

@christianbltr
Copy link
Member

Did you insert the result list plugin via TypoScript?
If yes, this issue should be fixed in current master with fef7e6b .

Could you please test that?

@Hawkeye1909
Copy link

Hello @christianbltr,
no, that's not the case I was refering to. As I wrote it is caused by the fact that a field 'loadFlexformsFromOtherCE' already existed in pi_flexform before I changed the CE to be a searchbox...
I wanted to try version 5.1.0 but ran into issue #195. So I could only test with search by filter and the result is the same:
No results when pi_flexform looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
    <data>
        <sheet index="MAIN">
            <language index="lDEF">
                <field index="loadFlexformsFromOtherCE">
                    <value index="vDEF"></value>
                </field>
                <field index="resultPage">
                    <value index="vDEF"></value>
                </field>
                <field index="cssFile">
                    <value index="vDEF"></value>
                </field>
                <field index="showTextInsteadOfResults">
                    <value index="vDEF">0</value>
                </field>
                <field index="showNoResultsText">
                    <value index="vDEF">0</value>
                </field>
                <field index="countSearchPhrases">
                    <value index="vDEF">1</value>
                </field>
                <field index="textForResults">
                    <value index="vDEF"></value>
                </field>
            </language>
        </sheet>
        [...]
    </data>
</T3FlexForms>

Results are there when it looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
    <data>
        <sheet index="MAIN">
            <language index="lDEF">
                <field index="resultPage">
                    <value index="vDEF"></value>
                </field>
                <field index="cssFile">
                    <value index="vDEF"></value>
                </field>
                <field index="showTextInsteadOfResults">
                    <value index="vDEF">0</value>
                </field>
                <field index="showNoResultsText">
                    <value index="vDEF">0</value>
                </field>
                <field index="countSearchPhrases">
                    <value index="vDEF">1</value>
                </field>
                <field index="textForResults">
                    <value index="vDEF"></value>
                </field>
            </language>
        </sheet>
        [...]
    </data>
</T3FlexForms>

@christianbltr
Copy link
Member

Thanks for explaining. This is fixed in version 5.1.2. BTW I could only reproduce this by placing the search box plugin after the search result plugin because the search result is stored in a singleton and if the search box plugin is rendered first everything worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants