Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-solr-connector
Advanced tools
A simple React component which provides access to a Solr server
A React component which provides access to a Solr server. Suitable for use in simple React apps which do not make use of a state management framework like Redux. Since the component uses the Solr JSON API, only versions from 5 onward are supported (and I have only tested with 6.0.0).
Install the module with npm:
npm install --save react-solr-connector
The module exports one default object, SolrConnector
. This should be used to wrap your application components:
import SolrConnector from 'react-solr-connector';
...
<SolrConnector searchParams={searchParams}>
<MyApp/>
</SolrConnector>
SolrConnector
injects a solrConnector
prop into all of its immediate children. This is an object with the structure:
{
searchParams,
busy,
response,
error
}
SolrConnector is passed a prop called searchParams
(which is also copied into the injected solrConnector
prop). If searchParams
contains a non-empty query then the search is performed asynchronously and busy
is set to true (this could be used to indicate to the user that a search is in progress, for example by displaying a spinner). response
is null until a response from Solr is received, at which point it is set to the value of the response object from Solr (including the responseHeader
, the main response
object, and any facets
, highlighting
objects, etc.) busy
is also set to false
. If an error occurs, the error
property is set (to a descriptive string) instead of the response
property. A search is performed when the component first mounts, and thereafter any time it receives new props.
searchParams
must have the following properties as a minimum:
{
solrSearchUrl,
query
}
Where query
is the user-entered query string and solrSearchUrl
is a Solr search endpoint, e.g.:
http://localhost:8983/solr/techproducts/select
If you are serving the app from a different host then you will have to enable CORS on Solr, or use a proxy service.
Optional properties for doSearch
are:
{
offset,
limit,
filter,
fetchFields,
facet,
highlightParams
}
Most of these correspond exactly with properties in the
Solr JSON API.
The exceptions are fetchFields
, which corresponds to the Solr fields
(which is not a very clear name in my opinion) and highlightParams
. In fact, highlightParams can contain any of the "traditional" Solr params that the JSON API does not currently support, but highlighting is the most obvious application.
If you have cloned the react-solr-connector
GitHub repository,
you can run the jest
tests with the following commands:
$ npm install
$ npm tests
To run the simple demo, install Solr 6 and start it with the techproducts
example:
$ bin/solr start -e techproducts
then start the Webpack demo server:
$ npm start
and point your browser at http://localhost:8080/demo/index.html
.
FAQs
A simple React component which provides access to a Solr server
The npm package react-solr-connector receives a total of 30 weekly downloads. As such, react-solr-connector popularity was classified as not popular.
We found that react-solr-connector demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.