php - Silverstripe fulltextsearch on custom field -
i'm using silverstripe fulltextsearch. interrogation how search in custom field , show results. there code write in index.md :
file: mysite/code/myindex.php:
<?php class myindex extends solrindex { function init() { $this->addclass('mypage'); $this->addfulltextfield('description'); } }
in page.php
class page_controller extends contentcontroller { private static $allowed_actions = array('search'); public function search($request) { $query = new searchquery(); $query->search($request->getvar('q')); return $this->renderwith('array( 'searchresult' => singleton('myindex')->search($query) )); } }
when i'm trying search words description field, no results found... suggestions?
in experience fulltextsearch has been frustrating , problematic. willing corrected, feel devs moving away in place of using searchfilters (https://docs.silverstripe.org/en/3.1/developer_guides/model/searchfilters/).
if helpful @ wrote module allows custom searching , displaying results in custom controller. isn't efficient fulltextsearch works pretty (https://github.com/i-lateral/silverstripe-searchable).
i did try write module using fulltextsearch, couldn't working.
Comments
Post a Comment