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.

The CONTAINS predicate is optional for search queries on columns of most data types; however, for large object<br />

types and text, this predicate is mandatory. You can build a search query with the CONTAINS predicate as<br />

follows:<br />

SELECT * FROM <br />

WHERE CONTAINS ((, , ), )<br />

When you specify the CONTAINS predicate, <strong>SAP</strong> <strong>HANA</strong> runs the following internal checks:<br />

● <strong>SAP</strong> <strong>HANA</strong> checks if the query contains one or more terms. If the query contains multiple terms, the terms<br />

are tokenized and concatenated.<br />

● <strong>SAP</strong> <strong>HANA</strong> checks whether the query is to be run on one or more columns. If you only specify one column, to<br />

optimize the search, additional processes are skipped and the query is run on the single column. If you specify<br />

a wildcard, and therefore possibly numerous columns, <strong>SAP</strong> <strong>HANA</strong> automatically determines which columns<br />

are relevant for the search query.<br />

After the checks are performed, <strong>SAP</strong> <strong>HANA</strong> builds and runs an internal query on the relevant columns only.<br />

Note:<br />

If a column has a full text index assigned, <strong>SAP</strong> <strong>HANA</strong> will automatically search on the index rather than on<br />

the original column.<br />

Determination of Search-Relevant Columns<br />

You can specify the search-relevant columns either at the creation of the view or directly for the query. <strong>SAP</strong> <strong>HANA</strong><br />

determines which relevant columns to search based on the following hierarchy:<br />

1. You specify a list of columns within the CONTAINS predicate. Even if a list of columns has been defined for<br />

the view, it is overridden by the columns stated in the query.<br />

2. If you enter an asterisk (*) instead of a column list but you specified a list of relevant columns when creating<br />

the view, this list is used for the query.<br />

3. If you enter an asterisk (*) and no list was provided when the view was created, all visible columns of the view<br />

or table are considered as search-relevant.<br />

For information about creating views, see Creating Views in the <strong>SAP</strong> <strong>HANA</strong> Administration <strong>Guide</strong>.<br />

Search Operators and Syntax<br />

With the CONTAINS predicate, <strong>SAP</strong> <strong>HANA</strong> supports the following search operators:<br />

● OR<br />

Matches are returned that contain at least one of the terms joined by the OR operator.<br />

● - (minus)<br />

With a minus sign, <strong>SAP</strong> <strong>HANA</strong> searches in columns for matches that do not contain the term immediately<br />

following the minus sign.<br />

● " " (quotation marks)<br />

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

Enabling Search<br />

P U B L I C<br />

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

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

Saved successfully!

Ooh no, something went wrong!