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 Search with Stopwords<br />

Usage<br />

Stopwords are terms that are less significant for a search and are therefore not used to generate the result set. In<br />

other words, the search is carried out as if the stopwords are not present (either in the user input or in the<br />

database column).<br />

However, stopwords influence the score that is calculated. A record with stopwords identical to the user input<br />

gets a higher score than a record with differing or missing stopwords.<br />

Stopwords can be defined either as single terms or as stopword phrases consisting of multiple terms. Stopword<br />

phrases are only applied when all terms of the stopword appear in exactly the given order.<br />

Use case example: When searching for company names, the legal form (Ltd, SA, AG, and so on) is less significant<br />

and less selective than the other parts of the name.<br />

Stopwords are stored in a column-store table with the following format:<br />

CREATE COLUMN TABLE mystopwords<br />

(<br />

stopword_id VARCHAR(32) PRIMARY KEY,<br />

list_id VARCHAR(32) NOT NULL,<br />

language_code CHAR(2),<br />

term NVARCHAR(200) NOT NULL<br />

);<br />

Stopwords are language dependent. It is possible to define the language that a stopword is valid for. You can also<br />

define stopwords for all languages by not setting a language.<br />

(It makes sense to add the language information now so that you can make use of the feature when it is available,<br />

without having to change the stopword definitions.)<br />

As with term mappings, stopwords can be grouped together in multiple groups. Groups of stopwords are<br />

identified by the value of the list_id column that is part of the stopword table.<br />

INSERT INTO mystopwords VALUES (1, 'legalform', '', 'Ltd');<br />

INSERT INTO mystopwords VALUES (2, 'legalform', 'de', 'GmbH');<br />

INSERT INTO mystopwords VALUES (3, 'legalform', 'de', 'Gesellschaft mit<br />

beschränkter Haftung');<br />

INSERT INTO mystopwords VALUES (4, 'legalform', 'de', 'AG');<br />

INSERT INTO mystopwords VALUES (5, 'legalform', 'de',<br />

'Aktiengesellschaft');<br />

To activate stopwords for a search on a TEXT column, you need to provide two search options (similar to the<br />

options used for term mappings):<br />

● stopwordListId=mylist1,mylist2,mylist3<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. 291

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

Saved successfully!

Ooh no, something went wrong!