Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
<?php
|
|
2 |
|
|
3 |
/*
|
|
4 |
* This file is part of the Solarium package.
|
|
5 |
*
|
|
6 |
* For the full copyright and license information, please view the COPYING
|
|
7 |
* file that was distributed with this source code.
|
|
8 |
*/
|
|
9 |
|
|
10 |
namespace Solarium\Component\Facet; |
|
11 |
|
|
12 |
use Solarium\Component\FacetSetInterface; |
|
13 |
|
|
14 |
/**
|
|
15 |
* Facet query.
|
|
16 |
*
|
|
17 |
* @see https://lucene.apache.org/solr/guide/faceting.html#field-value-faceting-parameters
|
|
18 |
*/
|
|
19 |
class Field extends AbstractField |
|
20 |
{
|
|
21 |
/**
|
|
22 |
* Facet method enum.
|
|
23 |
*/
|
|
24 |
const METHOD_ENUM = 'enum'; |
|
25 |
|
|
26 |
/**
|
|
27 |
* Facet method fc.
|
|
28 |
*/
|
|
29 |
const METHOD_FC = 'fc'; |
|
30 |
|
|
31 |
/**
|
|
32 |
* Get the facet type.
|
|
33 |
*
|
|
34 |
* @return string
|
|
35 |
*/
|
|
36 | 12 |
public function getType(): string |
37 |
{
|
|
38 | 12 |
return FacetSetInterface::FACET_FIELD; |
39 |
}
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Limit the terms for faceting by a string they must contain. Since Solr 5.1.
|
|
43 |
*
|
|
44 |
* @param string $contains
|
|
45 |
*
|
|
46 |
* @return self Provides fluent interface
|
|
47 |
*/
|
|
48 | 12 |
public function setContains(string $contains): self |
49 |
{
|
|
50 | 12 |
$this->setOption('contains', $contains); |
51 |
|
|
52 | 12 |
return $this; |
53 |
}
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Get the facet contains.
|
|
57 |
*
|
|
58 |
* @return string|null
|
|
59 |
*/
|
|
60 | 12 |
public function getContains(): ?string |
61 |
{
|
|
62 | 12 |
return $this->getOption('contains'); |
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Case sensitivity of matching string that facet terms must contain. Since Solr 5.1.
|
|
67 |
*
|
|
68 |
* @param bool $containsIgnoreCase
|
|
69 |
*
|
|
70 |
* @return self Provides fluent interface
|
|
71 |
*/
|
|
72 | 12 |
public function setContainsIgnoreCase($containsIgnoreCase): self |
73 |
{
|
|
74 | 12 |
$this->setOption('containsignorecase', $containsIgnoreCase); |
75 |
|
|
76 | 12 |
return $this; |
77 |
}
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Get the case sensitivity of facet contains.
|
|
81 |
*
|
|
82 |
* @return bool|null
|
|
83 |
*/
|
|
84 | 12 |
public function getContainsIgnoreCase(): ?bool |
85 |
{
|
|
86 | 12 |
return $this->getOption('containsignorecase'); |
87 |
}
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Limit facet terms to those matching this regular expression. Since Solr 7.2.
|
|
91 |
*
|
|
92 |
* @param string $matches
|
|
93 |
*
|
|
94 |
* @return self Provides fluent interface
|
|
95 |
*/
|
|
96 | 12 |
public function setMatches(string $matches): self |
97 |
{
|
|
98 | 12 |
$this->setOption('matches', $matches); |
99 |
|
|
100 | 12 |
return $this; |
101 |
}
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Get the regular expression string that facets must match.
|
|
105 |
*
|
|
106 |
* @return string|null
|
|
107 |
*/
|
|
108 | 12 |
public function getMatches(): ?string |
109 |
{
|
|
110 | 12 |
return $this->getOption('matches'); |
111 |
}
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Exclude these terms, comma separated list. Use \, for literal comma. Since Solr 6.5.
|
|
115 |
*
|
|
116 |
* @param string $exclude
|
|
117 |
*
|
|
118 |
* @return self Provides fluent interface
|
|
119 |
*/
|
|
120 | 12 |
public function setExcludeTerms(string $exclude): self |
121 |
{
|
|
122 | 12 |
$this->setOption('excludeTerms', $exclude); |
123 |
|
|
124 | 12 |
return $this; |
125 |
}
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Get terms that should be excluded from the facet.
|
|
129 |
*
|
|
130 |
* @return string|null
|
|
131 |
*/
|
|
132 | 12 |
public function getExcludeTerms(): ?string |
133 |
{
|
|
134 | 12 |
return $this->getOption('excludeTerms'); |
135 |
}
|
|
136 |
}
|
Read our documentation on viewing source code .