Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the index (automatically), not working? #13

Closed
shacall2 opened this issue May 25, 2016 · 1 comment
Closed

Updating the index (automatically), not working? #13

shacall2 opened this issue May 25, 2016 · 1 comment

Comments

@shacall2
Copy link

I'm having issues getting the index to automatically update. I followed the instructions outlined here:

http://tnt.studio/blog/searching-for-bobby-fisher-with-laravel-5

I added all 4 of the static functions to my model (I'm assuming the boot method is in the same model?). When I insert a new record into my database (using the DB facade), nothing seems to get indexed. Search never finds these new records, unless I manually run: php artisan .index.

At this point, I'm not sure if it's a bug…or if I added the boot method to the wrong model…or if it's something else. Any help would be much appreciated!

I'm very happy with this package!

@nticaric
Copy link
Contributor

The DB facade doesn't trigger the created, updated and deleted events. In order to do that you need to use the model like:

$model = new Model;
$model->title = "Something";
$model->save();

The ->save() method will now trigger an according event. Or if you want to do it manualy:

$tnt->selectIndex("name.index");
$index = $tnt->getIndex();
//to insert a new document to the index
$index->insert(['id' => '11', 'title' => 'new title', 'article' => 'new article']);

sleepless pushed a commit to sleepless/tntsearch that referenced this issue Oct 25, 2017
* commit '5799a0d38550df62d1570e8bc9533297d6b114dd':
  POP Order: - Added admin-module with user-administration feature - Updated ITC to B2B - Special case for popmaterial.b2b@samsung.de: add all pop-managers to CC due to current unavailability of popmaterial.b2b@samsung.de
  bugfix2
  bugfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants