将站点从3升级到4。现有代码使用FullTextSearchable(根据http://jsfiddle.net/BlackLabel/xhpqedrt/1/)存在于3,而不存在于4。Google仅会导致相同性质的未回答问题。除this guide之外,这无济于事。但是我确实找到了SS4的this one,它并不是真正针对同一主题的,但是有所帮助。
这是我的代码:
_config.php
\SilverStripe\ORM\Search\FulltextSearchable::enable();
Page.php
use SilverStripe\ORM\Connect\MySQLSchemaManager;
private static $create_table_options = [
MySQLSchemaManager::ID => 'ENGINE=MyISAM'
];
Page.ss
$SearchForm
预期:显示标准搜索表单
实际:什么也没显示
我尽力将表单从现有站点硬编码到模板上,以查看搜索功能本身是否起作用:
Page.ss
<form id="SearchForm_SearchForm" action="/home/SearchForm" method="get" enctype="application/x-www-form-urlencoded">
<p id="SearchForm_SearchForm_error" class="message " style="display: none"></p>
<fieldset>
<input type="text" name="Search" value="Search" class="text nolabel" id="SearchForm_SearchForm_Search">
<div class="form-group">
<input type="submit" name="action_results" value="Go" class="action" id="SearchForm_SearchForm_action_results">
</div>
</fieldset>
</form>
预期:搜索结果页面显示输入的术语的相关搜索结果
实际:找不到404页