taoceanz

Anyone had issues getting basic SilverStripe search (FulltextSearchable::enable([SiteTree::class]);) returning results with silverstripe/fluent installed? I've got the error below. Fluent is hooking into the augmentSQL extend and altering the where clause to use a table that doesn't exist. I've seen Fluent create table names but call a table AS the localised table name and not just calling the localised table name. Thought maybe I'm missing some configuration or something. All I've done is enable FulltextSearchable on SiteTree, and added $SearchForm to the front-end.

TractorCow\Fluent\Extension\FluentExtension hooks into augmentSQL extend provided by SilverStripe\ORM\DataQuery->getFinalisedQuery::335 and alters table to include locale in table name: https://github.com/tractorcow-farm/silverstripe-fluent/blob/master/src/Extension/FluentExtension.php#L346

  1. Exception has occurred.
  2. SilverStripe\ORM\Connect\DatabaseException: Couldn't run query:
  3. SELECT DISTINCT count(*)
  4. FROM "SiteTree_Live"
  5. WHERE (
  6. MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('query*' IN BOOLEAN MODE)
  7. + MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('query*' IN BOOLEAN MODE)
  8. AND ShowInSearch <> 0)
  9. AND (("SiteTree_Localised_en_US"."ID" IS NOT NULL))
alt

FulltextSearchable::enable([SiteTree::class]); seems to do it

👍 (1)
MichalKleiner

add a filter condition to your query or remove the File class from the index

alt

is there a way to exclude files from search results, to give the CMS editors time to go and set permissions on assets?

alt

ah, found that it's returning files from assets

null

I believe fulltextsearch already does that - each result checks the canView method

alt

is it possible for search to only show results that the current user has access to?

jkersu

Ok cool thanks, just needed a sanity check 😂 Ill just let it keep running for a bit longer

null

The first reindex will spawn others if it needs to