Skip to content

Commit ae32096

Browse files
committed
Add support for NOFREQS
1 parent 6f6636e commit ae32096

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/Index.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Index extends AbstractIndex implements IndexInterface
2222
private $noOffsetsEnabled = false;
2323
/** @var bool */
2424
private $noFieldsEnabled = false;
25+
/** @var bool */
26+
private $noFrequenciesEnabled = false;
2527
/** @var array */
2628
private $stopWords = null;
2729

@@ -39,6 +41,9 @@ public function create()
3941
if ($this->isNoFieldsEnabled()) {
4042
$properties[] = 'NOFIELDS';
4143
}
44+
if ($this->isNoFrequenciesEnabled()) {
45+
$properties[] = 'NOFREQS';
46+
}
4247
if (!is_null($this->stopWords)) {
4348
$properties[] = 'STOPWORDS';
4449
$properties[] = count($this->stopWords);
@@ -254,6 +259,24 @@ public function setNoFieldsEnabled(bool $noFieldsEnabled): IndexInterface
254259
return $this;
255260
}
256261

262+
/**
263+
* @return bool
264+
*/
265+
public function isNoFrequenciesEnabled(): bool
266+
{
267+
return $this->noFrequenciesEnabled;
268+
}
269+
270+
/**
271+
* @param bool $noFrequenciesEnabled
272+
* @return IndexInterface
273+
*/
274+
public function setNoFrequenciesEnabled(bool $noFrequenciesEnabled): IndexInterface
275+
{
276+
$this->noFrequenciesEnabled = $noFrequenciesEnabled;
277+
return $this;
278+
}
279+
257280
/**
258281
* @param array $stopWords
259282
* @return IndexInterface
@@ -275,7 +298,6 @@ protected function makeQueryBuilder(): QueryBuilder
275298
/**
276299
* @param string $fieldName
277300
* @param array $values
278-
* @param string $separator
279301
* @return QueryBuilderInterface
280302
*/
281303
public function tagFilter(string $fieldName, array $values): QueryBuilderInterface

src/IndexInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public function isNoOffsetsEnabled(): bool;
2222
public function setNoOffsetsEnabled(bool $noOffsetsEnabled): IndexInterface;
2323
public function isNoFieldsEnabled(): bool;
2424
public function setNoFieldsEnabled(bool $noFieldsEnabled): IndexInterface;
25+
public function isNoFrequenciesEnabled(): bool;
26+
public function setNoFrequenciesEnabled(bool $noFieldsEnabled): IndexInterface;
2527
public function setStopWords(array $stopWords): IndexInterface;
2628
public function addTextField(string $name, float $weight = 1.0, bool $sortable = false, bool $noindex = false): IndexInterface;
2729
public function addNumericField(string $name, bool $sortable = false, bool $noindex = false): IndexInterface;

0 commit comments

Comments
 (0)