Actions6
Overview
This node integrates with Apache Solr, a powerful search platform, allowing users to perform various operations such as searching documents by query, adding or updating documents, and deleting documents in multiple ways. The "Search By Query" operation enables querying the Solr index using flexible search expressions, filtering results, sorting, and controlling pagination.
Common scenarios include:
- Retrieving documents matching specific criteria from a Solr index.
- Filtering search results based on categories, price ranges, or other fields.
- Sorting search results by relevance score, price, or other sortable fields.
- Paginating through large result sets.
Practical example:
- A user wants to find all products with the title containing "solr" and filter them to only those priced below 100, returning only the product name and price fields, sorted by price ascending.
Properties
| Name | Meaning |
|---|---|
| Query | The main search query string (e.g., title:solr or *:* to match all documents). |
| Additional Fields | Collection of optional parameters to customize the search: |
| - Default Field (Df) | The default field to search in if none specified in the query. |
| - Field List (Fl) | Comma-separated list of fields to return in the results. |
| - Query Operator (q.op) | The default operator for query expressions; options are AND or OR. |
| - Response Writer (Wt) | The response writer format to use (e.g., json). |
| - Rows | Number of rows (documents) to return. Minimum is 1. |
| - Sort | Sort order string, e.g., price asc or score desc. |
| - Start | Offset to start returning results from (for pagination). Minimum is 0. |
| Filter Queries (Fq) | One or more filter queries to further restrict results, e.g., category:electronics or price:[* TO 100]. |
Output
The output JSON contains the search results returned by Solr under the .response.docs property. Each item corresponds to a document matching the query, including the requested fields.
Example structure of one output item:
{
"json": {
"id": "123",
"title": "Solr Guide",
"price": 50,
...
},
"pairedItem": {
"item": 0
}
}
If the node performs other operations (not relevant here), the output JSON will contain the respective responses from Solr.
The node does not output binary data.
Dependencies
- Requires an Apache Solr instance accessible via network.
- Needs credentials specifying connection details: host, port, core, path, and optionally username/password for basic authentication.
- Uses the
@magierin-schnee/solr-clientlibrary internally to communicate with Solr. - The node expects a configured API key credential or equivalent authentication method for Solr access.
Troubleshooting
- Connection errors: Ensure the Solr host, port, core, and path are correctly configured and reachable from n8n.
- Authentication failures: Verify that the provided username and password (if used) are correct.
- Invalid query syntax: Malformed queries may cause errors; validate your query strings against Solr's query syntax.
- Empty results: Check that the query matches existing documents and that filters are not overly restrictive.
- Sorting issues: Ensure the sort field exists and is sortable in the Solr schema.
- Pagination problems: The
startparameter must be zero or positive; negative values will cause errors.
If the node throws errors, enabling "Continue On Fail" allows processing subsequent items without interruption, with error details included in the output JSON.