The power search allows you to use a boolean query to enter complex and precise queries.
This will get technical in parts, but we will try to provide examples that clarify the possibilities and behavior.
The Basic Triplet
The basic building block of the power search is this triplet of information:
- The property to search or filter on.
- The operator that defines the search.
- The value or values to search for.
Let's look at an example:
country = "US"
The property in this query is "country", the operator the "=" and the single value to search for "US". What will this query do? It will filter all Signals to show only those that were published in the US.
In order to negate any triplet definition, you can prefix it with the boolean operator NOT:
NOT country = "US"
While the order is counter to how we speak, this will return all Signals that have not been published in the US.
Compounds combine different parts of the query using boolean operators OR and AND. Using OR will return all results where the Signals satisfy at least one of the expressions to the left and right of the operator. Using AND will require Signals to satisfy the expressions both to the left and right of the operator.
In the power search, compounds need to be enclosed in parentheses. If a compound has more than two parts but uses the same boolean operator, a single parenthesis for the entire compound is sufficient. Let's look at a few valid examples:
(label CONTAINS "wireless" OR label CONTAINS "energy")
=> This will return Signals whose titles contain either the word wireless or the word energy or both.
(label CONTAINS "wireless" AND label CONTAINS "energy")
=> This will return Signals whose title contain both the word wireless and energy somewhere.
(label CONTAINS "wireless" OR label CONTAINS "energy" OR country = "US")
=> This will return Signals where at least one of the following is true: The title contains the word wireless; the title contains the word energy; the Signal was published in the US.
((label CONTAINS "wireless" OR label CONTAINS "energy") AND country = "US")
=> This query is a bit more complex. Here, both the left side and right sides of the AND need to be true. So the Signals need to both be published in the US and their titles need to contain at least one of the words wireless or energy.
We validate the power search you enter to see if it has a valid syntax. We will aim to improve the messages to provide more insight as to what is wrong with the query.
- Continue with: [2/3] The Power Search: Syntactic Sugar