Query syntax
Advanced queries give you the most flexibility in specifying what you want to search for. To build an advanced query, you use fields, which are categories of metadata that can appear on files. For example, an image file might have fields such as resolution, date_taken, and location.
This topic describes some of the ways you can create advanced queries. For more information, see the Apache Sol documentation at http://lucene.apache.org/solr.
Building an advanced query automatically
You can use the Search App to automatically build an advanced query using the fields listed under the Refine button.
In the Search App:
Procedure
Click Refine.
Click Add field.
Select a field from the menu.
Specify a value for the field.
Click the Advanced link.
The Search Console displays your query in the advanced query syntax.
Querying negative numbers
To query negative numbers, enclose the value in double quotation marks ("
). For example:
temperature:"−273.15"
Basic format
The basic format for a query is:
field:value
For example, this expression finds files that have a field called title that has a value called Quarterly Report:
title:"Quarterly Report"
Combining search terms
To combine search terms, use the +
and -
operators. For example:
+sender:jsmith -recipient:mjones
The query returns files where the sender field is jsmith
and the recipient field is not mjones
.
Multiple values for a single field
This table shows the ways that you can search using multiple values for a single field.
Format | Example | Description |
field:(value value) | sender:(jsmith mjones) | Returns files where the sender field is either jsmith or mjones . |
field:(+value +value) | body:(+sales +"Widget Inc") | Returns files where the body field includes both sales and Widget Inc . |
field:(-value -value) | date:(-august -september) | Returns files where the date field includes neither august nor september . |
field:(+value value -value) | recipient:(+jsmith mjones -lstewart) | Returns files where the recipient field includes both jsmith and mjones or only jsmith , but not lstewart . |
Ranges
This table describes the formats you can use to search for a range of values.
Format | Description |
field:[start-value TO end-value] |
Matches files that contain values in the specified range, including the start-value and end-value. For example, this search term returns files where the author's name begins with A, B, C, or D:
|
field:{start-value TO end-value} |
Matches files that contain values in the specified range, excluding the start-value and end-value. For example, this search term returns files where the author's name begins with B or C:
|
Wildcards
This table describes the wildcard characters you can use in your queries.
Character | Description |
? |
Matches a single character. For example, the search term |
* |
Matches any number of consecutive characters, including none. For example, the search term
|
Fuzzy search terms
Fuzzy searches return files that contain values similar to, but don't exactly match, the values you specify. To specify a fuzzy search term, insert a tilde (~) after a single-word search term.
For example, the search term red~
returns files that contain the word red
, but also files that contain words like bed
or beds
.
Querying negative numbers
To query negative numbers, enclose the value in double quotation marks ("
). For example:
temperature:"−273.15"