33namespace Erichard \ElasticQueryBuilder \Query ;
44
55use Erichard \ElasticQueryBuilder \Contracts \QueryInterface ;
6+ use Erichard \ElasticQueryBuilder \Features \HasBoost ;
67use Erichard \ElasticQueryBuilder \Features \HasMinimumShouldMatch ;
78
89class SimpleQueryStringQuery implements QueryInterface
910{
11+ use HasBoost;
1012 use HasMinimumShouldMatch;
1113
1214 /**
@@ -15,7 +17,6 @@ class SimpleQueryStringQuery implements QueryInterface
1517 public function __construct (
1618 protected array $ fields ,
1719 protected string $ query ,
18-
1920 private ?string $ flags = null ,
2021 private ?bool $ fuzzyTranspositions = null ,
2122 private ?int $ fuzzyMaxExpansions = null ,
@@ -27,7 +28,6 @@ public function __construct(
2728 private ?string $ quoteFieldSuffix = null ,
2829 private ?bool $ analyzeWildCard = null ,
2930 private ?bool $ autoGenerateSynonymsPhraseQuery = null ,
30-
3131 protected array $ params = [],
3232 ) {
3333 $ this ->minimumShouldMatch = $ minimumShouldMatch ;
@@ -36,69 +36,70 @@ public function __construct(
3636 public function setFlags (string |null $ flags ): self
3737 {
3838 $ this ->flags = $ flags ;
39+
3940 return $ this ;
4041 }
4142
42-
4343 public function setFuzzyTranspositions (bool |null $ fuzzyTranspositions ): self
4444 {
4545 $ this ->fuzzyTranspositions = $ fuzzyTranspositions ;
46+
4647 return $ this ;
4748 }
4849
49-
5050 public function setFuzzyMaxExpansions (int |null $ fuzzyMaxExpansions ): self
5151 {
5252 $ this ->fuzzyMaxExpansions = $ fuzzyMaxExpansions ;
53+
5354 return $ this ;
5455 }
5556
56-
5757 public function setFuzzyPrefixLength (int |null $ fuzzyPrefixLength ): self
5858 {
5959 $ this ->fuzzyPrefixLength = $ fuzzyPrefixLength ;
60+
6061 return $ this ;
6162 }
6263
63-
6464 public function setDefaultOperator (string |null $ defaultOperator ): self
6565 {
6666 $ this ->defaultOperator = $ defaultOperator ;
67+
6768 return $ this ;
6869 }
6970
70-
7171 public function setAnalyzer (string |null $ analyzer ): self
7272 {
7373 $ this ->analyzer = $ analyzer ;
74+
7475 return $ this ;
7576 }
7677
77-
7878 public function setLenient (bool |null $ lenient ): self
7979 {
8080 $ this ->lenient = $ lenient ;
81+
8182 return $ this ;
8283 }
8384
84-
8585 public function setQuoteFieldSuffix (string |null $ quoteFieldSuffix ): self
8686 {
8787 $ this ->quoteFieldSuffix = $ quoteFieldSuffix ;
88+
8889 return $ this ;
8990 }
9091
91-
9292 public function setAnalyzeWildCard (bool |null $ analyzeWildCard ): self
9393 {
9494 $ this ->analyzeWildCard = $ analyzeWildCard ;
95+
9596 return $ this ;
9697 }
9798
98-
9999 public function setAutoGenerateSynonymsPhraseQuery (bool |null $ autoGenerateSynonymsPhraseQuery ): self
100100 {
101101 $ this ->autoGenerateSynonymsPhraseQuery = $ autoGenerateSynonymsPhraseQuery ;
102+
102103 return $ this ;
103104 }
104105
@@ -168,6 +169,7 @@ public function build(): array
168169 }
169170
170171 $ this ->buildMinimumShouldMatchTo ($ data );
172+ $ this ->buildBoostTo ($ data );
171173
172174 $ build = $ this ->params ;
173175 $ build ['simple_query_string ' ] = $ data ;
0 commit comments