Searching tips: single queries
This article is a more detailed look at constructing single search queries in Close.
To start creating basic search queries right away, head over to the search overview help article. After reading this, check out our article on combining queries.
Full text
Type a word in the search bar:
john
Close will find any leads that contain the word john somewhere in the lead (including its contacts, activities, opportunities, and tasks). Queries are not case-sensitive, so john, John, and JOHN will all match.
Matches for lead and contact names are given higher priority. Leads named john or have contacts named john will be ranked higher in the search results than a lead that has john in a call note.
This query will also do a prefix search. Leads containing words that start with john will also be matched. Leads that have contacts named Johnson or Johnathan will also match the query.
You can also do a full-text search with multiple keywords:
john doe
This will find any leads that contain both the word john and the word doe (or words that start with john and doe). The two words can appear in any order-- or be in two completely different fields.
If you only want to see leads with words in a given order, add in double quotes to create a phrase match:
"john doe"
Now you'll still see leads matching john doe, but leads that have doe john will not show up. No prefix search is performed when using quotes, so a lead named johnson doe will not match this query either.
Email addresses are broken apart around the @ character if it is unquoted. Searching for joe@example would match joe@example.com and example@joe.com. But searching for "joe@example" would not match example@joe.com because the double quotes would make this an exact phrase match which respects the ordering.
Email bodies are excluded from Full Text searches
If you are looking to search through the text in an email body, use the query email_body:"..." instead.
Field search
While you can search all fields with a full-text search, you can also limit your search to one field. Field searches have three parts: the field name, an operator (colon or equal sign), and a keyword.
city: Zurich
city=Zurich
The above two queries are equivalent; the spacing around the colon/equal sign is optional and doesn't change the meaning of the query. Both searches will match leads that have the term Zurich in the city field.
If you are searching one field for multiple keywords, add in quotation marks/parentheses:
city:"New York"
name:( john doe )
The first query will do a phrase match for the city field. Leads with a city set to New York or New York City will match, but leads with York New or New Yorks will not. The second query will do a word match for the name fields. Order of words will not be taken into account but all words must match. So it would match John Doe as well as Doe John but not a name of just John.
Custom fields
Custom fields can be searched as well, just add custom. in front of the field name. Custom fields with spaces need surrounding quotes. For example:
custom.category: technology doesn't require quotes because "technology" is one word without any spaces.
"custom.Monthly Recurring Revenue": 1000 does require quotes because "Monthly Recurring Revenue" has spaces between each word.
Note: The custom. prefix may be dropped for convenience if the custom field doesn't have the same name as another field (e.g. "company" or "creator"). However, we recommend always using the custom. prefix when saving a Smart View to prevent it from breaking in the future.
User searches
updated_by: "Thomas Thumb" updated_by: Thomas
User fields can be searched with a user's full name in quotes.
Note: If everyone has a unique first name, you can shorten the search to the first name alone. However, we recommend always to use full names when saving a Smart View in case another user has the same first name in the future.
The special keyword me exists to match the current user. When using me, the query will automatically plug in the name of whoever is using the Smart View when searching leads. For example, everyone on a team could use the below search to see the leads they each specifically created:
created_by: me
Comparisons
We can search numeric fields with the operators >, <, >=, and <=.
activities >= 5
That query will list leads with at least 5 activities.
We can use the same techniques for monetary and percentage fields. (Just like spacing, the $ and % signs are optional.)
opportunity_value >= $100 produces the same result as opportunity_value>=100
opportunity_confidence>50% produces the same result as opportunity_confidence > 50
Date searches
Date fields can be filtered just like numeric fields. Many common date formats work:
last_communication: 2016-04-01
last_communication: 4/1/16
last_communication: "April 1st"
All three queries above match leads with a last communication date of April 1st, 2016. When a year isn't specified, the current year is used.
Date comparisons
last_communication > "4/1/16 6:45pm"
last_communication > "2016-04-01 18:45"
Both searches will pull in leads whose latest communication took place later than April 1st, 2016 at 6:45 pm.
Relative dates
Relative dates are especially helpful in smart views. The terms today, yesterday, now, and tomorrow can be used. They can be combined with comparisons as well ( >, <, >=, <= ):
created: today
updated: yesterday
task_due < now
opportunity_close: tomorrow
Week, month, and quarter can also be used. Note that the week starts on Sunday. If it's currently Wednesday, the search latest_call_created: "this week" will show all leads that had their latest call sometime between last Sunday and today.
latest_call_created: "this week"
opportunity_created:"this month"
last_lead_status_change_date: "last quarter"
You can also use a "x days ago" or "x weeks ago" format. The following searches match leads that were updated 30 days ago or less, and leads that were created more than 5 weeks ago:
date_updated <= "30 days ago"
created > "5 weeks ago"
Similarly, we can compare dates in the future using "x days/weeks from now":
opportunity_close < "2 weeks from now"
Here are some more examples showing different formatting options:
date_updated < "30d ago"
date_updated < "5 minutes ago"
date_updated < "2 days and 10 hours ago"
date_updated < "1 week ago"
Time zone searches
You can search for leads that are in a specific time zone (e.g. leads located on the East Coast in the United States):
timezone:ET
A few notes about time zones:
- A lead can be associated with multiple time zones if it has multiple addresses or phone numbers with different area codes.
- If you know that either phone numbers or addresses will be a better timezone predictor, add phone_ or address_ to your timezone keyword (e.g. phone_timezone , address_timezone
).
- When you search for a particular local time, we find leads where any of their time zones match the local time you requested.
- Keep in mind that the "Local time" column is not capable of showing multiple local times. If multiple time zones are associated with a lead, one local time is displayed at random.
Ready for more time(zone) traveling? Check out our combined query article for details on how to use the local_time keyword.
Sorting
When all leads are displayed, by default they are sorted by date last updated. However, there are other ways you can sort your leads. You can sort leads by typing directly into the search bar or by using the sort dropdown at the top right of the lead results table.
sort:display_name
This order leads alphabetically by their display name. (The display name is the lead name, or the primary contact name if there is no lead name.)
sort:-display_name
Adding a minus sign to the field name will reverse the order.
Leads can be sorted by any numeric or date field and by some text fields ( lead_name, display_name, contact_name). This applies to custom fields that are numeric or contain a date. Text and choice custom fields cannot be used for sorting.
Now you're ready to start combining search queries.