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.

Frequently Asked Questions<br />

Why are there results with a score lower than the requested fuzzySimilarity?<br />

In text fields, the parameter fuzzySimilarity sets the minimum similarity that a token has to match to be included<br />

in the search result. All other fuzzy search operations (for example, applying term mappings, considering<br />

stopwords, abbreviationSimilarity) can influence the score that you will see.<br />

How many misspellings are allowed with a particular fuzzySimilarity?<br />

This question is not easy to answer. The scoring algorithm is not linear to the number of misspellings; the position<br />

of the misspelling is also important. You can use the following example to familiarize yourself with it.<br />

DROP TABLE test;<br />

CREATE COLUMN TABLE test<br />

(<br />

id INTEGER PRIMARY KEY,<br />

companyname SHORTTEXT(200) FUZZY SEARCH INDEX ON<br />

);<br />

INSERT INTO test VALUES ('1','abc');<br />

INSERT INTO test VALUES ('2','abx');<br />

INSERT INTO test VALUES ('3','xbc');<br />

INSERT INTO test VALUES ('4','axc');<br />

INSERT INTO test VALUES ('5','abcx');<br />

INSERT INTO test VALUES ('6','xabc');<br />

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

WHERE CONTAINS(companyname, 'abc',<br />

FUZZY(0.5,'textSearch=compare,bestMatchingTokenWeight=1'))<br />

ORDER BY score DESC, id;<br />

SCORE ID COMPANYNAME<br />

1 1 abc<br />

0.89 5 abcx<br />

0.82 2 abx<br />

0.75 6 xabc<br />

0.61 3 xbc<br />

0.61 4 axc<br />

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

WHERE CONTAINS(companyname, 'abcx',<br />

FUZZY(0.5,'textSearch=compare,bestMatchingTokenWeight=1'))<br />

ORDER BY score DESC, id;<br />

SCORE ID COMPANYNAME<br />

1 5 abcx<br />

0.89 1 abc<br />

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