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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Therefore, for the example above we get:<br />

2000-01-04 -> 0.00<br />

2000-01-05 -> 0.95<br />

2000-01-06 -> 0.96<br />

...<br />

2000-01-09 -> 0.99<br />

2000-01-10 -> 1.0<br />

2000-01-11 -> 0.99<br />

2000-01-12 -> 0.98<br />

...<br />

2000-01-15 -> 0.95<br />

2000-01-16 -> 0.00<br />

The distance between dates is calculated following the rules of the Gregorian calendar.<br />

The special case 'fuzzySimilarity = 1.0' and maxDateDistance=n is allowed and returns all dates within a range of n<br />

days with a rank of 1.0.<br />

Dates That Meet Both Conditions<br />

If a date meets the conditions of a typo and also the conditions of the maxDateDistance parameter, two scores<br />

are calculated for the same date. In this case, the score() function returns the highest of both scores. This is<br />

shown in the following example:<br />

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

WHERE CONTAINS(dateofbirth, '2000-01-10', FUZZY(0.8, 'maxDateDistance=5'))<br />

ORDER BY score DESC;<br />

This query returns the following:<br />

2000-01-04 -> 0.00<br />

2000-01-05 -> 0.80<br />

2000-01-06 -> 0.84<br />

2000-01-07 -> 0.88<br />

2000-01-08 -> 0.92<br />

2000-01-09 -> 0.96<br />

2000-01-10 -> 1.0<br />

300<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!