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.

SELECT ... FROM documents WHERE doc_content LIKE '% Driethanolamyn %' ...<br />

Supported SQL data types are<br />

● TEXT<br />

● SHORTTEXT<br />

● Full-text index<br />

A full-text index is an additional index structure that can be defined for non-text columns to add text search<br />

features. Supported column types are, for example, NCLOB and NVARCHAR.<br />

It is possible to speed up the fuzzy search by creating additional data structures, which are used for faster<br />

calculation of the fuzzy score. These data structures exist in the memory only, so no additional disk space is<br />

required. To create the additional structures, use the flag 'fast_fuzzy_search' when creating a TEXT or<br />

SHORTTEXT column or when creating a full-text index.<br />

To get the best response times possible, you should enable the fast fuzzy search structures for all database<br />

columns that have a high load of fuzzy searches and for all database columns that are used in performance-<br />

critical queries.<br />

Other Types<br />

Fuzzy search is available for the SQL type DATE. A fuzzy search on date values checks for date-specific errors<br />

such as dates that lie within a given range of days, or dates where the month and day have been interchanged (for<br />

example, American versus British date format).<br />

It is not possible to create additional data structures for date types to speed up the search. The queries run with<br />

optimal performance without any database tuning.<br />

Syntax<br />

You can call the fuzzy search by using the CONTAINS() function with the FUZZY() option in the WHERE clause of a<br />

SELECT statement.<br />

Basic example without additional search options<br />

SELECT SCORE() AS score, *<br />

FROM documents<br />

WHERE CONTAINS(doc_content, 'Driethanolamyn', FUZZY(0.8))<br />

ORDER BY score DESC;<br />

Example with additional search options<br />

Additional search options that change the default behavior of the fuzzy search can be specified as additional<br />

string parameters in the FUZZY() function.<br />

SELECT SCORE() AS score, *<br />

FROM documents<br />

WHERE CONTAINS(doc_content, 'Driethanolamyn', FUZZY(0.8, 'option1=value1,<br />

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