With the new phonetic and
fuzziness functions, it is now possible
to use SteelArrow for "fuzzy" searching. This demo uses a database of given
names, and a very small script to demonstrate the functionality.
The script to retrieve the data is as follows;
<!--- Get the phonetic sound of the name --->
<SASET NAME=phName VALUE=Phonetic( PARAM.name )>
<!--- Compare against the values in the database --->
<SAQUERY NAME=results DATASOURCE="Phonetic">
SELECT * FROM Phonetic WHERE key = '#phName#'
</SAQUERY>
<SAIF COND=results.RowCount()>
<!--- Iterate over the database results --->
<SAWHILE COND=results.MoreData()>
<!--- Get "fuzziness" of database word to supplied word --->
<SASET NAME=results.fuzzy[]
VALUE=Fuzziness(tolower(PARAM.name),tolower(results.word))>
<SANEXT NAME=results>
</SAWHILE>
<SAFIRST NAME=results>
<SASET NAME=results VALUE=results.Sort("fuzzy" )>
</SAIF>
|