teamtnt / laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
MIT License
1.1k stars 144 forks source link

Indexing issue ? #144

Closed vool closed 3 months ago

vool commented 6 years ago

I have a query re the operation of the tntsearch:import command where it does not seem to be indexing my models correctly,

I have a published key on my model I only want models indexed if published is set.

When I update the model or run scout:import they are indexed correctly but when I run tntsearch:import models are indexed regardless of published

Or is this the correct operation of tntsearch:import

Below is my toSearchableArray


public function toSearchableArray()
    {

        // only add to search index if story is published and approved

        if ($this->published) {

            $array = $this->toArray();

        }else{

            $this->unsearchable();

            $array = [];

        }

        return $array;
    }