Upgrade to 3.0 failed with multiple problems

I don’t know why that system setting was not in the list in the database. I just looked at the list, or should I have done it differently?

It’s getting a bit above my head; I’m not a developer :frowning: .

It’s normal that this system setting doesn’t exist.

The question is, why you get the wrong class-name if there is no system setting overriding the correct one.


Have you tried changing line 73 to this $connectorRequestClass = "MODX\Revolution\modConnectorRequest"; just to test if that changes anything?

This solution worked for me :slight_smile:

I’ve tried the fixes here but I still can’t get simplesearch working on Modx3. It’s definitely using the driver as if i change the system setting to a random value the page gets a 500 error.

When it’s the full qualified path it works, but just no data.

I only really get one bit of feedback in the logs:

[2023-08-08 08:37:06] (ERROR @ /xxxxxx/xxxxxxx/xxxxxxx/xxxxxxx/public/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42S22 executing statement: 
Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'modResource.contentType' in 'where clause'
)

What confuses me is I don’t use a where clause, at least that I’m aware of.

I’ll also drop in my simplesearch call:

[!SimpleSearch?
                &ids=`2623`
                &docFields=`pagetitle,description,contentType,publishedon,content`
                &includeTVs=`1`
                &processTVs=`1`
                &minChars=`2`
                &includeTVList=`resource-library-theme,resource-library-business-area,resource-library-resource-type,resource-library-keywords,highlighted,use-pagetitle-as-url`
                &fieldPotency=`pagetitle:100,resource-library-keywords:200`
                &perPage=`1000`
                &idType=`parents`
                &tpl=`SimpleSearchResultsIDs`
                &toPlaceholder=`idlist`
                &containerTpl=`__SearchResultsIDs`
                &noResultsTpl=`@INLINE no-results`
            ]]

This exact page / template works without a hitch on Modx 2.8.5 with simplesearch 2.1.2.

I suddenly realised that there was a contentType in the docFields. I removed but now the page won’t load (500 error).

I get the below in my apache logs:

[Tue Aug 08 10:34:27.601497 2023] [proxy_fcgi:error] [pid 905657] [client xx.xxx.xxx.xxx:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: SimpleSearch\\SimpleSearch::createExtract(): Argument #1 ($text) must be of type string, null given, called in /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/cache/includes/elements/modx/revolution/modsnippet/152.include.cache.php on line 88 and defined in /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/components/simplesearch/src/SimpleSearch.php:340\nStack trace:\n#0 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/cache/includes/elements/modx/revolution/modsnippet/152.include.cache.php(88): SimpleSearch\\SimpleSearch->createExtract()\n#1 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/src/Revolution/modScript.php(88): include('...')\n#2 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/src/Revolution/modParser.php(505): MODX\\Revolution\\modScript->process()\n#3 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx/public/core/components/pdotools/src/Parsing/Parser.php(276): MODX\\Revolution\\modParser->processTag()\n#4 /home/storm/sites/te...', referer: https://xxx.xxxxxxxxxxxxx.xxx/publications/?search=g99&id=2623

What version of SimpleSearch are you using? The current version “3.0.0-pl” for MODX 3?

@halftrainedharry That’s correct, version 3.0.0

There is no field “contentType”. The field is called “content_type” (but it doesn’t make sense to use that as a field to search in.)


It seems that (at least) one of the matching resources has a “content” value of “null”.

@halftrainedharry thank you for your help. I’ve still had no luck.

Adding the below gets the page to load again, but still no results:

&showExtract=`0`

Weirdly the search is working on other pages, a whole site search for example.

I’m just a little confused as I would expect it to work as it did previously.

I can’t reproduce the problem.

You could try (temporarily) adding these lines

$c->prepare();
$sql = $c->toSql();
$this->modx->log(\modX::LOG_LEVEL_ERROR, $sql);

to the code here:

This should log the SQL query hat is used to the MODX error log. Then analyse the query to see what is wrong and why it doesn’t return anything.

There seems to be a bug in the code with the property &toPlaceholder.

Change this line in the code, so that the second function parameter is a string an not a boolean:

public function output(string $output = '', string $toPlaceholder = ''): string

Thank you so much, I just came to say weirdly the query worked great in the database. I edited the line mentioned and that solved the issue.

Could you deduce from the SQL query, why the “content” has a null value?

The field is just blank. The pages being searched used to be static resources, but I transitioned to resources. Migrating the content fields to a template variable and using this as a download link on the now resources. Going forward they may also use the content field.

I’ve just come across a new weird issue. I’m now getting a 500 error on some terms and not others.

/search-results?sitesearch=heat+pump&id=113 fails
/search-results?sitesearch=operator&id=113 fails
/search-results?sitesearch=electricity&id=113 success
/search-results?sitesearch=test+test&id=113 success

I’m getting the below errors on the failed searches:

AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: SimpleSearch\\SimpleSearch::createExtract(): Argument #1 ($text) must be of type string, null given, called in /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/cache/includes/elements/modx/revolution/modsnippet/152.include.cache.php on line 88 and defined in /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/components/simplesearch/src/SimpleSearch.php:340\nStack trace:\n#0 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/cache/includes/elements/modx/revolution/modsnippet/152.include.cache.php(88): SimpleSearch\\SimpleSearch->createExtract()\n#1 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/src/Revolution/modScript.php(88): include('...')\n#2 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/src/Revolution/modParser.php(505): MODX\\Revolution\\modScript->process()\n#3 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxx-xxx/public/core/components/pdotools/src/Parsing/Parser.php(276): MODX\\Revolution\\modParser->processTag()\n#4 /xxxx/xxxxx/xxxxx/xxxxxxxxxxxxxx-xxx/public/core/s...', referer: https://www.xxxxxxxxxxxxxxx.xxx/search-results?sitesearch=heat-pump&id=113

Is there anything I could try?

This seems to be the same problem that occurs when the “content” field of the resource is null.

Try applying the changes from this pull request:

Thank you, i think id already done that from previous issue, but you telling me it was related reminded me on another search I added &showExtract=0 which solved the problem