Use SQL Search
Now, you will use SQL Search to return all records in the table that contain phrases referencing the visibility and temperature.
- Open an SQL Shell in the Web Terminal by entering the following command:
This will display the following output:
SQL Command Line Shell
The command prefix is currently set to: < >.
Enter q to quit, ? for help.
- Next, use SQL Search as a
WHERE clause condition of a
SELECT query. The
WHERE clause can contain other conditions associated by
- Run the following SQL Query in the
SELECT %iFind.Highlight(Narrative,'"visibility [1-4] mile*" AND "temp* ? degrees"')
WHERE %ID %FIND search_index(NarrBasicIdx,'"visibility [1-4] mile*" "temp* ? degrees"',0,'en')End code.
In the code above, the
search_index() function specifies the
search_item parameter as
"visibility [1-4] mile*" "temperature ? degree*". This returns all records that contain both positional phrases, in any order:
"visibility [1-4] mile*" returns phrases with from 1 to 4 words between the words visibility and mile. Because
mile* specifies a wildcard, it could match either mile or miles, for example:
- visibility less than 1 mile
- visibility 10 miles
- visibility approximately 20 statute miles
- visibility for many miles
"temp* ? degrees" returns phrases with a word beginning with temp and ending in 0 or more non-space wildcard characters, a single missing word, and then the word degrees. Thus it would return records with the following phrases:
- temperature 20 degrees
- temp. 20 degrees
- temperature in degrees
"temp* ? degrees" could also return the phrase temporarily without degrees, which is probably unintended.
This example also highlights the returned text by applying the same
search_item to the returned records, which highlights every instance of either of these phrases by delimiting them with <b> and </b> tags. For example, the query might return a report like the following:
At 0902, a weather observation from Puntilla Lake was reporting, in part: wind, calm; <b>visibility, 25 statute miles</b>; clouds and sky condition, 5,000 feet overcast, <b>temperature, 23 degrees</b> F; dew point 21 degrees F; altimeter, 30.35 inHG.End code.
search_index function also specifies a few other parameters:
search_index parameter is the SQL Search index defined earlier,
search_option parameter can apply an optional transformation to the search. Here it is set to the default, 0, meaning no search transformation.
search_language parameter specifies the default,
To learn more about using SQL Search and the different options that you can specify for each parameter, continue to the What's Next? section below.