File tree Expand file tree Collapse file tree 5 files changed +57
-13
lines changed Expand file tree Collapse file tree 5 files changed +57
-13
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## [ 4.0.0] ( https://github.com/pmatseykanets/laravel-scout-postgres/releases/tag/v4.0.0 ) - 2018-11-15
4
+
5
+ ### Added
6
+
7
+ - Added support for Scout 6
8
+
3
9
## [ 3.1.0] ( https://github.com/pmatseykanets/laravel-scout-postgres/releases/tag/v3.1.0 ) - 2018-10-20
4
10
5
11
### Added
Original file line number Diff line number Diff line change @@ -12,10 +12,6 @@ This package makes it easy to use native PostgreSQL Full Text Search capabilitie
12
12
## Contents
13
13
14
14
- [ Installation] ( #installation )
15
- - [ Scout 5] ( #scout-5 )
16
- - [ Scout 4] ( #scout-4 )
17
- - [ Scout 2, 3] ( #scout-2-3 )
18
- - [ Scout 1] ( #scout-1 )
19
15
- [ Laravel] ( #laravel )
20
16
- [ Lumen] ( #lumen )
21
17
- [ Configuration] ( #configuration )
@@ -36,25 +32,31 @@ This package makes it easy to use native PostgreSQL Full Text Search capabilitie
36
32
37
33
You can install the package via composer:
38
34
39
- ### Scout 5
35
+ ** Scout 6 **
40
36
41
37
``` bash
42
38
composer require pmatseykanets/laravel-scout-postgres
43
39
```
44
40
45
- ### Scout 4
41
+ ** Scout 5**
42
+
43
+ ``` bash
44
+ composer require pmatseykanets/laravel-scout-postgres:3.1.0
45
+ ```
46
+
47
+ ** Scout 4**
46
48
47
49
``` bash
48
50
composer require pmatseykanets/laravel-scout-postgres:2.3.0
49
51
```
50
52
51
- ### Scout 2, 3
53
+ ** Scout 2, 3**
52
54
53
55
``` bash
54
56
composer require pmatseykanets/laravel-scout-postgres:1.0.0
55
57
```
56
58
57
- ### Scout 1
59
+ ** Scout 1**
58
60
59
61
``` bash
60
62
composer require pmatseykanets/laravel-scout-postgres:0.2.1
Original file line number Diff line number Diff line change 27
27
"illuminate/contracts" : " ~5.4" ,
28
28
"illuminate/database" : " ~5.4" ,
29
29
"illuminate/support" : " ~5.4" ,
30
- "laravel/scout" : " ~5 .0"
30
+ "laravel/scout" : " ~6 .0"
31
31
},
32
32
"require-dev" : {
33
33
"phpunit/phpunit" : " ~6.0" ,
Original file line number Diff line number Diff line change @@ -541,4 +541,23 @@ protected function usesSoftDeletes(Model $model)
541
541
{
542
542
return method_exists ($ model , 'getDeletedAtColumn ' );
543
543
}
544
+
545
+ /**
546
+ * Flush all of the model's records from the engine.
547
+ *
548
+ * @param \Illuminate\Database\Eloquent\Model $model
549
+ * @return void
550
+ */
551
+ public function flush ($ model )
552
+ {
553
+ if (! $ this ->shouldMaintainIndex ($ model )) {
554
+ return ;
555
+ }
556
+
557
+ $ indexColumn = $ this ->getIndexColumn ($ model );
558
+
559
+ $ this ->database
560
+ ->table ($ model ->searchableAs ())
561
+ ->update ([$ indexColumn => null ]);
562
+ }
544
563
}
Original file line number Diff line number Diff line change @@ -74,15 +74,32 @@ public function test_delete_do_nothing_if_index_maintenance_turned_off_globally(
74
74
{
75
75
list ($ engine , $ db ) = $ this ->getEngine (['maintain_index ' => false ]);
76
76
77
+ $ db ->shouldNotReceive ('table ' );
78
+
79
+ $ engine ->delete (Collection::make ([new TestModel ()]));
80
+ }
81
+
82
+ public function test_flush_removes_all_objects_from_index ()
83
+ {
84
+ list ($ engine , $ db ) = $ this ->getEngine ();
85
+
77
86
$ db ->shouldReceive ('table ' )
87
+ ->once ()
78
88
->andReturn ($ table = Mockery::mock ('stdClass ' ));
79
- $ table ->shouldReceive ('whereIn ' )
80
- ->with ('id ' , [1 ])
81
- ->andReturnSelf ();
82
89
$ table ->shouldReceive ('update ' )
90
+ ->once ()
83
91
->with (['searchable ' => null ]);
84
92
85
- $ engine ->delete (Collection::make ([new TestModel ()]));
93
+ $ engine ->flush (new TestModel ());
94
+ }
95
+
96
+ public function test_flush_does_nothing_if_index_maintenance_turned_off_globally ()
97
+ {
98
+ list ($ engine , $ db ) = $ this ->getEngine (['maintain_index ' => false ]);
99
+
100
+ $ db ->shouldNotReceive ('table ' );
101
+
102
+ $ engine ->flush (new TestModel ());
86
103
}
87
104
88
105
public function test_search ()
You can’t perform that action at this time.
0 commit comments