Solr Search Queries
Searching for data using Solr search syntax
Last updated
Searching for data using Solr search syntax
Last updated
By enabling the advanced search feature, you can take advantage of Solr's flexible search syntax to analyze your data. For example, you can search for data that contains the terms 'Climate' and 'Financing' in close proximity to each other, or search for data or dates that fall within a specific range.
You can add Solr search queries by enabling 'Advanced search' under the search bar, then checking the 'Add query syntax to search' check box.
The following are examples of searches for a specific keyword or search phrase.
Task | Example | Syntax |
Search for a keyword in a specific field | Search for the keyword |
|
Search for a phrase in a specific field | Search for the phrase |
|
Search for a phrase in one field and a second phrase in another field | Search for |
|
Combine searches for multiple phrases or keywords using operators such as AND or OR | Search for |
|
Search for a keyword in a specific field, excluding search results with another keyword in the same field | Search for |
|
Search for data in which a field does not contain a specific value | Search for data where the inStock field is not false |
|
Search for values in a specified range | Search for values from |
|
You can use the wildcard character (*) to search for results that are not exact matches. Solr search syntax does not support using a wildcard symbol as the first character of a search.
Task | Example | Syntax |
Search for words starting with a string of characters | Search for any word that starts with |
|
Search for words starting and ending with specific strings of characters | Search for any word that starts with |
|
Search for values in a field that are less than or equal to a specified numeric value | Search for values in the code field that are less than or equal to 100 |
|
Search for values in a field that are greater than or equal to a specified numeric value | Search for values in the code field that are greater than or equal to 100 |
|
Search for data that contains a specific field | Find data that includes the message field |
|
Search for data that does not contain a specific field | Find data that does not have a message field |
|
You can search for terms that are a given number of words away from each other (called a proximity search).
Task | Example | Syntax |
Search for keywords that are a specific number of words away from each other | Search for |
|
Search for transposed words | Search for |
|
You can approximate a search for multiple keywords (for example, a search for business AND analysis) using a search with a large proximity value, such as "business analysis"~10000000
. For practical purposes, this returns the same group of results as searching for business AND analysis. Unlike a search for business AND analysis, however, results in which business and analysis are closer together are regarded as having a higher search relevance. However, the proximity search also requires more time and system resources to perform.
You can determine which parts of a search query are treated as more important by providing a numeric boost factor. For example, the following query assigns higher importance to matches in the title field than matches in the body field: (title:MicroStrategy OR title:Analytics)^1.5 (body:Intelligence OR body:Server)
.
For a detailed overview of Solr query syntax, including information about creating queries that take advantage of functions, nested queries, boost factors, and more, see the official documentation for the query parser syntax. In most cases, Solr uses the standard Lucene query syntax to perform searches. For a list of exceptions, see the Solr wiki.