QBO 3 provides two basic search patterns:
A Smart Search comprises three phases:
For example, take:
The "terms" generated by "123 Main Street" include:
The Valuation.config file defines four search terms to check:
For the "123 Main Street" search against a demo database, the results would include (assuming the associated rows exist):
Smart Search Hints
Smart Search results will occasionally return unexpected (and perhaps undesirable) results. The most common example is returning a row by matching an identity column. It is very useful for a power user to search by Loan.LoanID, Valuation.ValuationID or Contact.ContactID, but users searching for Loan.Loan = '12345' probably don't intend to look for Loan.LoanID = 12345.
This issue can be addressed by "hints". Let's assume that we're looking for someone with the last name of 'Patrick', living in the zip code '12345'. We do not intend to match people living at 12345 Patrick Street, nor do we want to see ContactID 12345.
For the smart search string '12345 Patrick', the terms built will be:
For the smart search string 'zip:12345 last:Patrick', the terms built will be:
The HintTerm and HintValue columns returned by the dbo.SearchTerms function allows us to tweak the Smart Search clauses, like this:
For search terms like Contact.ContactID, we can modify the clause to require a hint:
This way, '12345 Woodlawn':
Searching 'zip:12345 Woodlawn':
But we can still do: 'id:12345':
Terms that affect the Order By only
Some columns are not distinct enough to serve as a search term, such as Contact.FirstName. The number of 'Patrick's (as a first name) may be very large; far fewer have Patrick as a last name. As a result, we don't want to waste time table scanning the Contact table for FirstName = 'Patrick'. However, given a result set including say 120 contacts with the last name of 'Patrick', it is often useful to specify the FirstName of 'Sophia', and have her at the top of the list.
This can be achieved as follows:
In this case, the Contact join is immediately being limited to the Contacts that have already been added to the Smart Search result set (e.g. the 120 Contacts with a LastName of 'Patrick').
While "Smart Search" attempts to simplify the QBO search experience for 99% of searches, QBO 3 vastly simplifies advanced searching with our SqlPattern class. If you want to just find 123 Main Street by address, without also getting ValuationID 123 in the search results:
or, more interestingly, find Valuations starting with '201203' in Foothill Ranch:
The QBO 3 main menu includes a control that combines both Smart Search and Advanced Search functionality. Each page rendering a main menu can specify what kind of searching is being done by calling an xsl:template. For example, Valuation.Home.xslt:
The SearchOptions parameter allows the developer to control the behavior of the "global" search box. In the example above, the global search box will present the user with a Valuation-specific advanced search criteria.
The "MainMenu" template exists in Theme.xslt, and includes this snippet:
The text box (
The icon (
This, by itself, does nothing. However, if a Search panel exists on the page, and is specified to listen for a 'search' event, the panel will invoke a Smart Search.