mirror of
https://github.com/opencultureconsulting/orcli.git
synced 2025-04-13 00:00:49 +02:00
search examples
This commit is contained in:
parent
603e86c60d
commit
5065f6bf0f
@ -60,8 +60,8 @@ Examples:
|
|||||||
--separator , \
|
--separator , \
|
||||||
--mode records \
|
--mode records \
|
||||||
--suffix ]}$'\n' \
|
--suffix ]}$'\n' \
|
||||||
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode":
|
--facets '[ { "type": "text", "columnName": "name", "mode": "regex",
|
||||||
"regex", "caseSensitive": false, "query": "Ben" } ]' \
|
"caseSensitive": false, "query": "^Ben" } ]' \
|
||||||
| jq
|
| jq
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -33,9 +33,11 @@ Examples:
|
|||||||
orcli export tsv "duplicates"
|
orcli export tsv "duplicates"
|
||||||
orcli export tsv "duplicates" --output "duplicates.tsv"
|
orcli export tsv "duplicates" --output "duplicates.tsv"
|
||||||
orcli export tsv "duplicates" --encoding "ISO-8859-1"
|
orcli export tsv "duplicates" --encoding "ISO-8859-1"
|
||||||
orcli export tsv "duplicates" --facets '[ { "type": "text", "name": "foo",
|
orcli export tsv "duplicates" --facets '[ { "type": "text", "columnName":
|
||||||
"columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben"
|
"name", "mode": "regex", "caseSensitive": false, "query": "^Ben" } ]'
|
||||||
} ]'
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression":
|
||||||
|
"grel:filter([\"gender\",\"purchase\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0",
|
||||||
|
"columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ orcli search
|
|||||||
|
|
||||||
apply regex to each column and print matches in flattened tsv format
|
apply regex to each column and print matches in flattened tsv format
|
||||||
output: index column value
|
output: index column value
|
||||||
|
note that any exporter supports search by using --facets (see examples)
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
orcli search PROJECT [REGEX] [OPTIONS]
|
orcli search PROJECT [REGEX] [OPTIONS]
|
||||||
@ -27,8 +28,14 @@ Arguments:
|
|||||||
Examples:
|
Examples:
|
||||||
orcli search "duplicates" "^Ben"
|
orcli search "duplicates" "^Ben"
|
||||||
orcli search 1234567890123 "^Ben"
|
orcli search 1234567890123 "^Ben"
|
||||||
orcli search "duplicates" "^F$" --index "email"
|
orcli search "duplicates" "^F" --index "email"
|
||||||
orcli search "duplicates" | column -t -s $' '
|
orcli search "duplicates" | column -t -s $' '
|
||||||
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression":
|
||||||
|
"grel:filter(row.columnNames,cn,cells[cn].value.find(/^Ben/).length()>0).length()>0",
|
||||||
|
"columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression":
|
||||||
|
"grel:filter([\"gender\",\"purchase\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0",
|
||||||
|
"columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
11
orcli
11
orcli
@ -571,7 +571,7 @@ orcli_search_usage() {
|
|||||||
printf "orcli search\n"
|
printf "orcli search\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
printf " apply regex to each column and print matches in flattened tsv format\n output: index column value\n"
|
printf " apply regex to each column and print matches in flattened tsv format\n output: index column value\n note that any exporter supports search by using --facets (see examples)\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -617,8 +617,10 @@ orcli_search_usage() {
|
|||||||
printf "%s\n" "Examples:"
|
printf "%s\n" "Examples:"
|
||||||
printf " orcli search \"duplicates\" \"^Ben\"\n"
|
printf " orcli search \"duplicates\" \"^Ben\"\n"
|
||||||
printf " orcli search 1234567890123 \"^Ben\"\n"
|
printf " orcli search 1234567890123 \"^Ben\"\n"
|
||||||
printf " orcli search \"duplicates\" \"^F$\" --index \"email\"\n"
|
printf " orcli search \"duplicates\" \"^F\" --index \"email\"\n"
|
||||||
printf " orcli search \"duplicates\" | column -t -s \$'\t'\n"
|
printf " orcli search \"duplicates\" | column -t -s \$'\t'\n"
|
||||||
|
printf " orcli export tsv \"duplicates\" --facets '[{ \"type\": \"list\", \"expression\":\n \"grel:filter(row.columnNames,cn,cells[cn].value.find(/^Ben/).length()>0).length()>0\",\n \"columnName\": \"\", \"selection\": [{\"v\": {\"v\": true}}] }]'\n"
|
||||||
|
printf " orcli export tsv \"duplicates\" --facets '[{ \"type\": \"list\", \"expression\":\n \"grel:filter([\\\\\"gender\\\\\",\\\\\"purchase\\\\\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0\",\n \"columnName\": \"\", \"selection\": [{\"v\": {\"v\": true}}] }]'\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -806,7 +808,8 @@ orcli_export_tsv_usage() {
|
|||||||
printf " orcli export tsv \"duplicates\"\n"
|
printf " orcli export tsv \"duplicates\"\n"
|
||||||
printf " orcli export tsv \"duplicates\" --output \"duplicates.tsv\"\n"
|
printf " orcli export tsv \"duplicates\" --output \"duplicates.tsv\"\n"
|
||||||
printf " orcli export tsv \"duplicates\" --encoding \"ISO-8859-1\"\n"
|
printf " orcli export tsv \"duplicates\" --encoding \"ISO-8859-1\"\n"
|
||||||
printf " orcli export tsv \"duplicates\" --facets '[ { \"type\": \"text\", \"name\": \"foo\",\n \"columnName\": \"name\", \"mode\": \"regex\", \"caseSensitive\": false, \"query\": \"Ben\"\n } ]'\n"
|
printf " orcli export tsv \"duplicates\" --facets '[ { \"type\": \"text\", \"columnName\":\n \"name\", \"mode\": \"regex\", \"caseSensitive\": false, \"query\": \"^Ben\" } ]'\n"
|
||||||
|
printf " orcli export tsv \"duplicates\" --facets '[{ \"type\": \"list\", \"expression\":\n \"grel:filter([\\\\\"gender\\\\\",\\\\\"purchase\\\\\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0\",\n \"columnName\": \"\", \"selection\": [{\"v\": {\"v\": true}}] }]'\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -903,7 +906,7 @@ orcli_export_template_usage() {
|
|||||||
printf " cat \"template.txt\" | orcli export template \"duplicates\"\n"
|
printf " cat \"template.txt\" | orcli export template \"duplicates\"\n"
|
||||||
printf " orcli export template \"duplicates\" \"https://example.com/template.txt\"\n"
|
printf " orcli export template \"duplicates\" \"https://example.com/template.txt\"\n"
|
||||||
printf " orcli export template \"duplicates\" \"template.txt\" --output \"duplicates.tsv\"\n"
|
printf " orcli export template \"duplicates\" \"template.txt\" --output \"duplicates.tsv\"\n"
|
||||||
printf " orcli export template \"duplicates\" \\\\\n <<< '{ \"name\" : {{jsonize(cells[\"name\"].value)}}, \"purchase\" :\n {{jsonize(cells[\"purchase\"].value)}} }' \\\\\n --prefix '{ \"events\" : [' \\\\\n --separator , \\\\\n --mode records \\\\\n --suffix ]}$'\\\n' \\\\\n --facets '[ { \"type\": \"text\", \"name\": \"foo\", \"columnName\": \"name\", \"mode\":\n \"regex\", \"caseSensitive\": false, \"query\": \"Ben\" } ]' \\\\\n | jq\n"
|
printf " orcli export template \"duplicates\" \\\\\n <<< '{ \"name\" : {{jsonize(cells[\"name\"].value)}}, \"purchase\" :\n {{jsonize(cells[\"purchase\"].value)}} }' \\\\\n --prefix '{ \"events\" : [' \\\\\n --separator , \\\\\n --mode records \\\\\n --suffix ]}$'\\\n' \\\\\n --facets '[ { \"type\": \"text\", \"columnName\": \"name\", \"mode\": \"regex\",\n \"caseSensitive\": false, \"query\": \"^Ben\" } ]' \\\\\n | jq\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -211,6 +211,8 @@ commands:
|
|||||||
help: |-
|
help: |-
|
||||||
apply regex to each column and print matches in flattened tsv format
|
apply regex to each column and print matches in flattened tsv format
|
||||||
output: index column value
|
output: index column value
|
||||||
|
note that any exporter supports search by using --facets (see examples)
|
||||||
|
|
||||||
args:
|
args:
|
||||||
- *project
|
- *project
|
||||||
- ®ex
|
- ®ex
|
||||||
@ -223,8 +225,12 @@ commands:
|
|||||||
examples:
|
examples:
|
||||||
- orcli search "duplicates" "^Ben"
|
- orcli search "duplicates" "^Ben"
|
||||||
- orcli search 1234567890123 "^Ben"
|
- orcli search 1234567890123 "^Ben"
|
||||||
- orcli search "duplicates" "^F$" --index "email"
|
- orcli search "duplicates" "^F" --index "email"
|
||||||
- orcli search "duplicates" | column -t -s \$'\t'
|
- orcli search "duplicates" | column -t -s \$'\t'
|
||||||
|
- |-
|
||||||
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression": "grel:filter(row.columnNames,cn,cells[cn].value.find(/^Ben/).length()>0).length()>0", "columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
- |-
|
||||||
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression": "grel:filter([\\\\"gender\\\\",\\\\"purchase\\\\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0", "columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
help: run functional tests on tmp OpenRefine workspace
|
help: run functional tests on tmp OpenRefine workspace
|
||||||
@ -271,7 +277,9 @@ commands:
|
|||||||
- orcli export tsv "duplicates" --output "duplicates.tsv"
|
- orcli export tsv "duplicates" --output "duplicates.tsv"
|
||||||
- orcli export tsv "duplicates" --encoding "ISO-8859-1"
|
- orcli export tsv "duplicates" --encoding "ISO-8859-1"
|
||||||
- |-
|
- |-
|
||||||
orcli export tsv "duplicates" --facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]'
|
orcli export tsv "duplicates" --facets '[ { "type": "text", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "^Ben" } ]'
|
||||||
|
- |-
|
||||||
|
orcli export tsv "duplicates" --facets '[{ "type": "list", "expression": "grel:filter([\\\\"gender\\\\",\\\\"purchase\\\\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0", "columnName": "", "selection": [{"v": {"v": true}}] }]'
|
||||||
|
|
||||||
- name: template
|
- name: template
|
||||||
help: export to any text format by providing your own GREL template
|
help: export to any text format by providing your own GREL template
|
||||||
@ -311,7 +319,7 @@ commands:
|
|||||||
--separator , \\\\
|
--separator , \\\\
|
||||||
--mode records \\\\
|
--mode records \\\\
|
||||||
--suffix ]}$'\\\n' \\\\
|
--suffix ]}$'\\\n' \\\\
|
||||||
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]' \\\\
|
--facets '[ { "type": "text", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "^Ben" } ]' \\\\
|
||||||
| jq
|
| jq
|
||||||
|
|
||||||
- name: run
|
- name: run
|
||||||
|
@ -21,7 +21,7 @@ cd "${tmpdir}" || exit 1
|
|||||||
orcli import csv "${t}.csv" --projectName "${t}"
|
orcli import csv "${t}.csv" --projectName "${t}"
|
||||||
orcli export tsv "${t}" \
|
orcli export tsv "${t}" \
|
||||||
--output "${t}.output" \
|
--output "${t}.output" \
|
||||||
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]'
|
--facets '[ { "type": "text", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "^Ben" } ]'
|
||||||
|
|
||||||
# test
|
# test
|
||||||
diff -u "${t}.assert" "${t}.output"
|
diff -u "${t}.assert" "${t}.output"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user