FIX: Reduce number of terms injected for host lexeme.

We do prefix matching in search so there is no need to inject the extra
terms.

Before:
```
"'discourse':10,11 'discourse.org':10,11 'org':10,11 'test':8A,10,11 'test.discourse.org':10,11 'titl':4A 'uncategor':9B"
```

After:
```
"'discourse.org':10,11 'org':10,11 'test':8A 'test.discourse.org':10,11 'titl':4A 'uncategor':9B"
```
This commit is contained in:
Guo Xiang Tan
2020-07-27 15:22:54 +08:00
parent 0f53ad58c2
commit 15e9057ec5
2 changed files with 9 additions and 5 deletions

View File

@@ -65,7 +65,7 @@ class SearchIndexer
break if count >= 10 # Safeguard here to prevent infinite loop when a term has many dots
term, _, remaining = lexeme.partition(".")
break if remaining.blank?
array << "'#{term}':#{positions} '#{remaining}':#{positions}"
array << "'#{remaining}':#{positions}"
lexeme = remaining
end
end