
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Super simple (and small) Command Line Interface to perform frequend actions upon Solr instance.
Search features are provided from pysolr lib by Django Haystack.
pip install solrcli
Solrcli can take parameters in two ways:
Using config file allows you to set up different environments. See example below hosts.yml
:
production-server:
host: solr-production.foo.com
core: products
sanity_checks:
column_values_at_least:
column: enabled
staging-server:
host: solr-staging.foo.com
core: products
sanity_checks:
column_values_at_least:
column: enabled
You can choose enviroment in the command line as:
(venv) $ python -m solrcli -c hosts.ini -i test-server reload
If you prefer to provide params each time you can pass --host
and --core
as application options before command.
Print help informations for main command with python -m solrcli --help
. Use --help
after the command to print specific options.
Usage: solrcli.py [OPTIONS] COMMAND [ARGS]...
Options:
--host TEXT Solr hostname with port
--core TEXT Solr core
-c, --config TEXT config file path
--skipconf / --no-skipconf ignore configurations
--help Show this message and exit.
Commands:
fullimport
getconfig
post
query
reload
showsettings
status
Invoke core reload
(venv) $ python -m solrcli --host=my-solr-instance.com --core=core0 reload
Get config from Solr instance passing feature from the list below:
(venv) $ python -m solrcli --host=my-solr-instance.com --core=core0 getconfig --feature=dataimport
Get core status. If you use --waitfinish
the script will wait until fullimport
finish.
The --notify
allows you to receive an email with core counts.
Usage: solrcli.py status [OPTIONS]
Options:
--waitfinish / --no-waitfinish Wait if data import is running
--notify TEXT Comma separated list of e-mail to deliver
result
--help Show this message and exit.
Post initial data eventually fetched from remote storage.
If you use --waitfinish
the script will wait until the server/core is online (aka 200
as status code).
Usage: solrcli post [OPTIONS]
Options:
--waitfinish / --no-waitfinish Wait if data import is running
--remotepath TEXT Remote path to look into for initial file
--localpath TEXT Local path where input file will be saved
--help Show this message and exit.
Invoke core data import handler.
Usage: solrcli.py fullimport [OPTIONS]
Options:
--sanitycheck / --no-sanitycheck
Perform full-import only if sanity check
succeded.
--notify TEXT Comma separated list of e-mail to deliver
result
--help Show this message and exit.
The --notify
params allows you to receive an e-mail after data import will be completed.
If --sanitycheck
is provided fullimport
is called only if all sanity checks are passed.
Sanity checks to be perfomed can be defined in the settings YAML file in the instance like below:
instances:
core-test:
host: my-solr-instance.com
core: core0
sanity_checks:
column_values_at_least:
column: published
This tool can be used to fetch small parts of an arbitrary response. Assume the following snippet is from a search
request like http://localhost:8973/solr/core0/search/en?rows=0&warehouse=123
{
"responseHeader": {
"status": 0,
"QTime": 13,
"params": {}
},
"grouped": {
"country": {
"matches": 320,
"ngroups": 212,
"groups": []
}
},
...
"facetes_list": {
"facet_fields": {
"languages": ["EN", 202,
"PT", 10],
...
}
Using solrcli we can get a single information
$ ./solrcli.py --skipconf query --url="http://localhost:8973/solr/core0/search/en?rows=0&warehouse=123" --find=grouped/contry/ngroups
Will return 212
because this value is extracted from the full response traversing nodes.
We can also fetch for childs:
$ ./solrcli.py --skipconf query --url="http://localhost:8973/solr/core0/search/en?rows=0&warehouse=123" --find=facetes_list/facet_fields/languages
obtaining
["EN", 202, "PT", 10]
We plan to build a set of sanity checks to be performed before full import call to prevent errors or inconsistent data sets.
Currently available sanity checks are:
column_values_at_least
: ensure at list 1
or gt
param value is present in column
custom_query
: perform a custom query and check if expected_result
is returned/search
or similar and get back only interesting nodesThis project is licensed under the GNU Affero General Public License v3.0 License - see the LICENSE file for details
FAQs
A super simple Solr Cli
We found that solrcli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.