28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FUZZY(0.8,<br />

'termMappingTable=termmappings,termMappingListId=01,textSearch=compare'))<br />

ORDER BY score DESC, id;<br />

SCORE ID COMPANYNAME<br />

1.0 2 <strong>SAP</strong> Aktiengesellschaft<br />

0.9 1 <strong>SAP</strong> AG<br />

SELECT TO_DECIMAL(SCORE(),3,2) AS score, * FROM companies<br />

WHERE CONTAINS(companyname, 'sap ag',<br />

FUZZY(0.8,'termMappingTable=TERMMAPPINGS,termMappingListId=01,textSearch=co<br />

mpare'))<br />

ORDER BY score DESC, id;<br />

SCORE ID COMPANYNAME<br />

1.0 1 <strong>SAP</strong> AG<br />

0.9 2 <strong>SAP</strong> Aktiengesellschaft<br />

To activate language-specific term mappings, you must provide the language parameter:<br />

SELECT TO_DECIMAL(SCORE(),3,2) AS score, * FROM companies<br />

WHERE CONTAINS(companyname, 'sap ag',<br />

FUZZY(0.8,'termMappingTable=TERMMAPPINGS,termMappingListId=01,textSearch=co<br />

mpare'), language('de'))<br />

ORDER BY score DESC, id;<br />

Note: In this case, all term mappings where language_code is set to 'de' or empty will be used. Any term<br />

mappings with other language codes will be ignored.<br />

Fuzzy Search on DATE Columns<br />

A fuzzy search on DATE columns supports two types of error:<br />

● Date-specific typos<br />

● Dates lying within a user-defined maximum distance<br />

Score Calculation for Typos<br />

Instead of using Levenshtein distance or other string-compare algorithms, the following date-specific typos and<br />

errors are defined as similar:<br />

1. One wrong digit at any position (for example, 2011-08-15 instead of 2011-08-25). This type of error gets a<br />

score of 0.90.<br />

2. Two digits interchanged within one component (day, month, or year) (for example, 2001-01-12, 2010-10-12, or<br />

2010-01-21 instead of 2010-01-12). This type of error gets a score of 0.85.<br />

3. Month and day interchanged (US versus European date format) (for example, 2010-10-12 instead of<br />

298<br />

2010-12-10). This type of error gets a score of 0.80.<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved.<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Enabling Search

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!