Skip to content

Commit 5590179

Browse files
authored
Merge pull request #27 from polarityio/develop
Add search term normalization, remove v4, update dependencies, fix tests
2 parents 6004b15 + 7284962 commit 5590179

File tree

9 files changed

+4079
-2655
lines changed

9 files changed

+4079
-2655
lines changed

.github/workflows/run-int-dev-checklist.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ jobs:
1010
container: 'rockylinux:8'
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
15-
- name: Test NPM Install
16-
id: test-npm-install
17-
run: |
18-
npm ci
19-
- name: Polarity Integration Development Checklist
20-
id: int-dev-checklist
21-
uses: polarityio/polarity-integration-development-checklist@main
22-
with:
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
- uses: actions/checkout@v6
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: '18'
17+
- name: Test NPM Install
18+
id: test-npm-install
19+
run: |
20+
npm ci
21+
- name: Polarity Integration Development Checklist
22+
id: int-dev-checklist
23+
uses: polarityio/polarity-integration-development-checklist@main
24+
with:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ You should not specify `size` and `from` parameters as these parameters are cont
5858
As an example, with the search query defined as:
5959

6060
```
61-
{"query": { "simple_query_string": { "query": "\"{{entity}}\"" } }, "sort": [ {"timestamp": "desc" } ] } }
61+
{"query": { "simple_query_string": { "query": "\"{{entity}}\"" } }, "sort": [ {"timestamp": "desc" } ] }
6262
```
6363

6464
If the user has the IP 8.8.8.8 on their screen the integration will execute the following query:
6565

6666
```
67-
{"query": { "simple_query_string": { "query": "\"8.8.8.8\"" } }, "sort": [ {"timestamp": "desc" } ] } }
67+
{"query": { "simple_query_string": { "query": "\"8.8.8.8\"" } }, "sort": [ {"timestamp": "desc" } ] }
6868
```
6969

7070
If you'd like to search certain fields you can use the `fields` property along with the `simple_query_string`. For example, to only search the `ip` field you could use the following search:
7171

7272
```
73-
{"query": { "simple_query_string": { "query": "\"{{entity}}\"", "fields": ["ip"]}}, "sort": [ {"timestamp": "desc" } ] } }
73+
{"query": { "simple_query_string": { "query": "\"{{entity}}\"", "fields": ["ip"]}}, "sort": [ {"timestamp": "desc" } ] }
7474
```
7575

7676
If you'd like to search a specific time range you can do that using normal Elasticsearch JSON search syntax. For example, do search data from the last 365 days you can use the following query assuming your timestamp field is called `timestamp`.
@@ -143,6 +143,17 @@ Maximum number of concurrent search requests (defaults to 10). Integration must
143143

144144
Minimum amount of time in milliseconds between each entity search (defaults to 50). Integration must be restarted after changing this option.
145145

146+
### Search Term Normalization
147+
148+
Normalize the search term by applying a normalization function to the entity. If set, all entities will be normalized. Defaults to "None".
149+
150+
Valid options are:
151+
152+
* Lowercase the search term
153+
* Uppercase the search term
154+
* Search term matches input
155+
* None - Use Polarity default casing
156+
146157
## Installation Instructions
147158

148159
Installation instructions for integrations are provided on the [PolarityIO GitHub Page](https://polarityio.github.io/).

config/config.js

Lines changed: 0 additions & 213 deletions
This file was deleted.

config/config.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,37 @@
210210
"type": "boolean",
211211
"userCanEdit": false,
212212
"adminOnly": true
213+
},
214+
{
215+
"key": "searchTermNormalization",
216+
"name": "Search Term Normalization",
217+
"description": "Modify the casing of the search term (i.e., {{ENTITY}}), by applying a normalization function to the entity. If set, all entities will be normalized. Defaults to \"None\".",
218+
"default": {
219+
"value": "none",
220+
"display": "None - use Polarity default casing"
221+
},
222+
"type": "select",
223+
"options": [
224+
{
225+
"value": "none",
226+
"display": "None - use Polarity default casing"
227+
},
228+
{
229+
"value": "lower",
230+
"display": "Lowercase the search term"
231+
},
232+
{
233+
"value": "upper",
234+
"display": "Uppercase the search term"
235+
},
236+
{
237+
"value": "exact",
238+
"display": "Search term matches input"
239+
}
240+
],
241+
"multiple": false,
242+
"userCanEdit": false,
243+
"adminOnly": true
213244
}
214245
]
215246
}

0 commit comments

Comments
 (0)