You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pages/users/search/advanced/index.mdx
+104-4Lines changed: 104 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,7 @@ What this translates to: Give me matches that include the keyword "Putin", but a
77
77
density={2}
78
78
/>
79
79
80
-
<Callout>Using this operator with too high a number (greater than 3, for example) will cause slow searches and may return too many false results.</Callout>
81
-
82
-
{/* TODO The max value for fuzzy searches is 2. */}
80
+
<Callout>You can only search for spelling variations with a maximum difference of two letters.</Callout>
83
81
84
82
## Search for words that should be in proximity to each other
85
83
@@ -123,7 +121,109 @@ You can build on these searches even further like so:
123
121
124
122
This translates to: Give me all matches in which each match must contain the keyword Trump and must contain either the keyword Salman or the keyword Putin, but must not contain the keywords South Korea.
125
123
126
-
## Full search syntax
124
+
## Filter search results based on specific properties
125
+
126
+
You can filter search results based on the values of specific entity properties. For example, the following query will return only entities with `[email protected]` as a value of the `email` property:
An important difference to other search queries is that these filters only match exact values. For example, the query above wouldn’t match an entity with `[email protected]` (without the dot between the first and last name). If you want to match such variations, you can use the `~` operator introduced above or a regular expression search.
Filtering search results based on property values isn’t available for properties of type [`text`](https://followthemoney.tech/explorer/types/text/). For example, the following query won’t return any results (even if there is an entity with a matching `notes` property), because [`notes`](https://followthemoney.tech/explorer/schemata/Thing/#property-notes) is of the `text` property type.
148
+
</Callout>
149
+
150
+
### Filter based on date properties
151
+
152
+
In addition to the queries described in the previous section, you can use special operators to filter search results based on date properties.
153
+
154
+
For example, the following query returns only entities with a value greater than `2010-07-01` (July 1st, 2010) in the `incorporationDate` property:
155
+
156
+
```
157
+
properties.incorporationDate:>2010-07-01
158
+
```
159
+
160
+
To search for entities with an incorporation date including July 1st, use the `>=` operator:
161
+
162
+
```
163
+
properties.incorporationDate:>=2010-07-01
164
+
```
165
+
166
+
Searching for values less than a value works analogously:
167
+
168
+
```
169
+
properties.incorporationDate:<2010-07-01
170
+
properties.incorporationDate:<=2017-07-01
171
+
```
172
+
173
+
You can also query results with values in a range. FOr example, the following query returns only entities with a value between `2010-01-01` and `2015-12-31`:
174
+
175
+
```
176
+
properties.incorporationDate:[2010-01-01 TO 2015-12-31]
177
+
```
178
+
179
+
The bounds of the range are inclusive, that is, in case of the query above, it includes entities with values of `2015-01-01` and `2015-12-31` in the `incorporationDate` property.
180
+
181
+
### Filter based on numeric properties
182
+
183
+
You can use the same operators described in the previous section to filter search results based on numeric properties. However, you need to prefix the property names with `numeric.` instead of `properties.`.
184
+
185
+
For example, the following query returns only entities with a value greater than `99` in the `rowCount` property:
186
+
187
+
```
188
+
numeric.rowCount:>99
189
+
```
190
+
191
+
## Filter search results based on metadata
192
+
193
+
Aleph stores additional information about entities that isn’t part of the entity properties. This includes the entity schema and the ID of the dataset or investigation the entity is part of. While you can filter based on this information using Aleph’s search UI, you can also use it in search queries:
194
+
195
+
### Filter based on entity schema
196
+
197
+
The following query returns only `LegalEntity` entities:
198
+
199
+
```
200
+
schema:LegalEntity
201
+
```
202
+
203
+
Note that this does not include entities with a schema that inherits from `LegalEntity`. For example, while the `Company` schema inherits from `LegalEntity`, it wouldn’t return `Company` entities.
204
+
205
+
Instead, you can use the following query to return only entities that use the `LegalEntity` schema or any schema inheriting from `LegalEntity` (such as `Person` or `Company`):
206
+
207
+
```
208
+
schemata:LegalEntity
209
+
```
210
+
211
+
### Filter based on dataset or investigation
212
+
213
+
To filter based on a dataset or investigation, you need to know its ID. You can find the ID in the URL of the dataset or investigation. For example, in the following two URLs, the IDs are `123` and `456`, respectively.
214
+
215
+
```
216
+
https://aleph.occrp.org/datasets/123
217
+
https://aleph.occrp.org/investigations/456
218
+
```
219
+
220
+
You can then use the ID to filter search results to include only entities from a particular dataset or investigation. For example, the following query returns only entities from the dataset with the ID `123`:
221
+
222
+
```
223
+
collection_id:123
224
+
```
225
+
226
+
## Full search query syntax
127
227
128
228
Under the hood, Aleph uses a search engine called Elasticsearch. In addition to the advanced search options explained above, you can also use the full Elasticsearch query syntax. Please refer to the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax) for more information.
0 commit comments