Showing
1 changed file
with
6 additions
and
2 deletions
| ... | @@ -100,7 +100,11 @@ class SearchService | ... | @@ -100,7 +100,11 @@ class SearchService |
| 100 | $nameTerms = $this->generateTermArrayFromText($entity->name, 5); | 100 | $nameTerms = $this->generateTermArrayFromText($entity->name, 5); |
| 101 | $bodyTerms = $this->generateTermArrayFromText($entity->getText(), 1); | 101 | $bodyTerms = $this->generateTermArrayFromText($entity->getText(), 1); |
| 102 | $terms = array_merge($nameTerms, $bodyTerms); | 102 | $terms = array_merge($nameTerms, $bodyTerms); |
| 103 | - $entity->searchTerms()->createMany($terms); | 103 | + foreach ($terms as $index => $term) { |
| 104 | + $terms[$index]['entity_type'] = $entity->getMorphClass(); | ||
| 105 | + $terms[$index]['entity_id'] = $entity->id; | ||
| 106 | + } | ||
| 107 | + $this->searchTerm->newQuery()->insert($terms); | ||
| 104 | } | 108 | } |
| 105 | 109 | ||
| 106 | /** | 110 | /** |
| ... | @@ -121,7 +125,7 @@ class SearchService | ... | @@ -121,7 +125,7 @@ class SearchService |
| 121 | 125 | ||
| 122 | $chunkedTerms = array_chunk($terms, 500); | 126 | $chunkedTerms = array_chunk($terms, 500); |
| 123 | foreach ($chunkedTerms as $termChunk) { | 127 | foreach ($chunkedTerms as $termChunk) { |
| 124 | - $this->searchTerm->insert($termChunk); | 128 | + $this->searchTerm->newQuery()->insert($termChunk); |
| 125 | } | 129 | } |
| 126 | } | 130 | } |
| 127 | 131 | ... | ... |
-
Please register or sign in to post a comment