File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1313 <language >en_US</language >
1414 <language >fr_FR</language >
1515 </languages >
16- <version >3.0.2 </version >
16+ <version >3.0.3 </version >
1717 <authors >
1818 <author >
1919 <name >Nicolas Barbey</name >
Original file line number Diff line number Diff line change 66use TeamTNT \TNTSearch \Support \Collection ;
77use TntSearch \Connector \PropelConnector ;
88use TntSearch \Index \TntSearchIndexInterface ;
9+ use \PDO ;
910
1011class PropelEngine extends SqliteEngine
1112{
@@ -20,6 +21,16 @@ public function createConnector(array $config): PropelConnector
2021 return new PropelConnector ;
2122 }
2223
24+ public function loadConfig (array $ config )
25+ {
26+ parent ::loadConfig ($ config );
27+
28+ if (!$ this ->dbh ) {
29+ $ connector = $ this ->createConnector ($ this ->config );
30+ $ this ->dbh = $ connector ->connect ($ this ->config );
31+ }
32+ }
33+
2334 public function saveWordlist (Collection $ stems )
2435 {
2536 $ terms = [];
@@ -61,7 +72,7 @@ public function saveWordlist(Collection $stems)
6172 $ this ->updateWordlistStmt ->bindValue (':hits ' , $ term ['hits ' ]);
6273 $ this ->updateWordlistStmt ->bindValue (':keyword ' , $ key );
6374 $ this ->updateWordlistStmt ->execute ();
64- if (!$ this ->inMemory ) {
75+ if (!$ this ->inMemory || ! array_key_exists ( $ key , $ this -> inMemoryTerms ) ) {
6576 $ this ->selectWordlistStmt ->bindValue (':keyword ' , $ key );
6677 $ this ->selectWordlistStmt ->execute ();
6778 $ res = $ this ->selectWordlistStmt ->fetch (PDO ::FETCH_ASSOC );
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public function getIndex(): TntIndexer
7474 $ connector = $ indexer ->createConnector ($ this ->config );
7575 $ this ->dbh = $ connector ->connect ($ this ->config );
7676
77- $ indexer ->setIndex ($ this ->index );
77+ $ indexer ->setIndex ($ this ->engine -> index );
7878 $ indexer ->setStemmer ($ this ->stemmer );
7979 $ indexer ->setTokenizer ($ this ->tokenizer );
8080 $ indexer ->loadConfig ($ this ->config );
You can’t perform that action at this time.
0 commit comments