How score() function works in HANA fuzzy search

Hi, i am confused by the score() returned value when i use this in fuzzy search in HANA
CREATE COLUMN TABLE test_similar_calculation_mode
( id INTEGER PRIMARY KEY, s text);
INSERT INTO test_similar_calculation_mode VALUES ('1','stringg');
INSERT INTO test_similar_calculation_mode VALUES ('2','string theory');
INSERT INTO test_similar_calculation_mode VALUES ('3','this is a very very very long string');
INSERT INTO test_similar_calculation_mode VALUES ('4','this is another very long string');
SELECT TO_INT(SCORE()*100)/100 AS score, id, s FROM test_similar_calculation_mode WHERE CONTAINS(s, 'theory', FUZZY(0.9, 'similarCalculationMode=compare')) ORDER BY score DESC;
the returned list is just as below
SCORE      ID      S
0.84            2       string theory
why i assign 0.9 as threshold in fuzzy function while this line with score 0.84 also be returned.
from my understanding, the S field is text data type, so the string actually is divided into seperate word list, so the score should be 1.0, is it right?
any hints is very appreciate,thanks

Hi William,
By default the score() function returns a TF/IDF score for text data types.
To get back the fuzzy score, you have to use the search option 'textSearch=compare' (or 'ts=compare'). Without other options, this gives an average score of all tokens ('string' and 'theory') and you get a score of 0.7 as a result.
To ignore the additional token 'string' in the database, you have to specify another option that tells the score function to use the tokens from the user input only ('cnmt=input').
So you should use
TO_INT(SCORE()*100)/100 AS score, id, s
FROM test_similar_calculation_mode
WHERE CONTAINS(s, 'theory', FUZZY(0.9, 'scm=compare, ts=compare, cnmt=input'))
ORDER BY score DESC;
to get the expected results.
Regards,
Jörg

Similar Messages

  • How Fuzzy score and Score() function works in HANA?

    Hi,
    I read fuzzy developer guide of HANA, but i am not getting how HANA calculate score() and fuzzy score?
    As per developer guide, Score() is calculate using TF/IDF, and I also try to calculate TF/IDF as per WIKI page, but it gives different values. and Score() value is changed as per x value of fuzzy(x) .
    See example
    select score() as sc, *
    from COMPANIES2
    where contains(Companyname,'IBM',fuzzy(0.7))
    it returns
    SC;                             ID; COMPANYNAME;  CONTACT
    0.7599999904632568;   6;  IBM Corp;               M. Master
    and for
    select score() as sc, *
    from COMPANIES2
    where contains(Companyname,'IBM',fuzzy(0.2))
    it return
    SC;                               ID;  COMPANYNAME;       CONTACT
    0.16945946216583252;   2;   SAP in Walldorf Corp;  Master Mister
    0.8392000198364258;     6;   IBM Corp;                   M. Master
    and table content of Companies2 is
    ID; Companyname;           contact
    1;  SAP Corp;                   Mister Master
    2;  SAP in Walldorf Corp;   Master Mister
    3;  ASAP;                         Nister Naster
    4;  ASAP Corp;                 Mixter Maxter
    5;  BSAP orp;                   Imster Marter
    6;  IBM Corp;                    M. Master
    Please provide any formula or algorithm for above.
    Thanks,
    Somnath A. Kadam

    Hi Somnath,
    It seems that the column "Companyname" has data type "SHORTTEXT" and here is the quote from SAP HANA Developer Guide Ch. 10.2.4.8 (p659)
    "Text types support a more sophisticated kind of fuzzy search. Texts are tokenized (split into terms), and the fuzzy comparison is performed term by term.
    When searching with 'SAP' for example, a record like 'SAP Deutschland AG & Co. KG' gets a high score, because the term 'SAP' exists in both texts. A record like 'SAPPHIRE NOW Orlando' gets a lower score, because 'SAP' is just a part of the longer term 'SAPPHIRE' (3 of 8 characters match)."
    So for text columns the score calculation is much more complex than tf-idf.
    As for the different fuzzy score, there is an explanation in the FAQ section ( Ch. 10.2.4.14, p736 "Is the score between request and result always stable for TEXT columns?")
    Basically, for each token, its similarity score will be used to calculate the overall result only if it is higher than the threshold given in fuzzy(). Any token with a lesser similarity score will be excluded. Therefore, slight change in the threshold may influence the overall score greatly.
    Here is an example.
    I added id 7 "SAP ASAP" to the data you used.
    Note that the similarity score between "ASAP" and "BSAP" is slightly over 0.74 and similarity score between "SAP" and "BSAP" is 0.75:
    For
        select score() as sc, * from COMPANIES2  where contains(COMPANYNAME,'BSAP',fuzzy(0.74))
    We get:
    <...omitted...>
    0.7474510073661804;    7;    SAP ASAP;        M. Master
    Now change the  threshold to 0.75 and the result is:
    <...omitted...>
    0.5588234663009644;    7;    SAP ASAP;        M. Master
    ID 7 now gets a lower score because "ASAP" is excluded and only "SAP" is used to calculate the overall result.
    As for tf-idf, it is used in the so-called freestyle search across multiple columns.
    An example from the same guide:
         select score() as sc, * from companies2 where contains((companyname,contact), 'IBM Master', FUZZY(0.7));
    Result:
    0.8103122115135193;    6;    IBM Corp;    M. Master
    Regards
    Roger Tao

  • How delete function works in apple, How delete function works in apple

    How delete function works; normally, it is working as backspace?

    yoga2000 wrote:
    How delete function works; normally, it is working as backspace?
    If you're a Windoze user, and, by some very remote chance, you're asking how to do ⌦ (forward delete) on a MacBook Pro keyboard, the answer is fn⌫ (fn-delete).
    You might benefit from
    Switch 101: On Windows, I used to...
    <http://support.apple.com/kb/HT2514>
    Apple Portables: Key placement and functions
    <http://support.apple.com/kb/HT3164>
    Mac OS X keyboard shortcuts
    <http://support.apple.com/kb/HT1343>

  • How MS_PURCHASE_ORDER_REPORTING function works?

    I want to know the functionality of this function. Because i have a requeriment in the me2s transaction.
    I need to replace the report by a smartform.
    And i need to know the functionality of this function (MS_PURCHASE_ORDER_REPORTING)
    thanks.

    a

  • I really can't understand how this recursive works??

    Hi all,
    I have got a recursive function that checks for palendrome string. But it is confusing. I know that a string is palenromme if it is empty or has a char or first char and last one are same and middle is palindromme too.
    but can't understand how this function works.
    class Palindromme
         boolean palindrom(String s)
              if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
                   return true;
              else
              {                    //recursive definition
                   return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
    specially i don't know how palindrom(s.substring(1,s.length()-1)); is working cause it has to be increased for each loop.
    abdul
    PS: actually i don't know how recursion works from Data structure point of view

    Hi,
    ok your palindrome is : "otto"
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                  o                     o                                   tt
    so first part is true                                        
    in the second part palindrom is called again but with the remaining tt
    so second time :
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                   t                     t                                 ""
    Third time:
    if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
    return true;after all for otto the recusion is:
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && s.charAt(1) == s.charAt(s.length()-2) ) && nothing left of otto);
    Phil

  • How does filter work

    Hi,
    i am trying to understand how filtering works in Diadem. I know of the CFCFiltChn in built function but i was wondering if anyone could tell/explain how that function works. Or post a link where i could read up on it. Any info would be greatly appreciated.
    Thanks
    ~sn

    Hi Shefalika,
    In the folder ..\DIAdem\Manuals you find a PDF called CrashAnalysis.pdf which describes the crash analysis functions. I attached this document.
    Greetings
    Walter
    Attachments:
    CrashAnalysis.pdf ‏1212 KB

  • How does YouTube search function work

    Hey all,
    Does anyone know how the search function works on AppleTV for YouTube? I know that not everything is on there yet...I know that...but things I have just watched...don't show up in the search?
    So it doesn't seem to be searching the video title...maybe it's searching tags only?
    Maybe certain video's haven't been indexed in the search yet but are already converted?
    Just kind of curious how this thing is searching.
    Thanks,
    tom

    I'm not sure anyone has actually worked out the search function works yet.

  • How to get the Wiki search functionality working?

    hi,
    Another Wiki question regarding the 7.1u1 Portal wiki functionality: What is necessary to get the wiki search functionality working? Right now when using the wiki search page all it does is return to the search form, no errors but no hits either. I guess some additional administrative work is needed to get search working?
    thanks, tom

    haven't touched anything except for the wiki template jsps to change the design. it is a linux rh4 install. there are no communities on that server (yet), just the wiki portlet in a tab so far. is the wiki search dependent on the portal search server or totally separate (ie self contained wiki search)? any additional services or such that need to be started for it to work?

  • Help with fuzzy search (doesn't work if change order of certain 2 letters)

    Hi,
    need some help with fuzzy search. It's pretty simple - we use fuzzy search on varchar2 columns that contain first name and last_name. The problem is that i don't really understand why it can't find name in some cases.
    Say i want to search for 'Taekpaul'. Then
    where CONTAINS(first_name,'fuzzy(TAEKPAUL)',1) > 0 - works
    where CONTAINS(first_name,'fuzzy(TAEKPALU)',1) > 0 - works (changed order of the 2 last letters)
    where CONTAINS(first_name,'fuzzy(TEAKPAUL)',1) > 0 - doesn't work, finds 'Tejpaul' that is completely unrelated (changed 2nd, 3rd order)
    How can i make it find 'Taekpaul' even if i search for TEAKPAUL? Is it related to index? Like Text index should be created with some different parameters?
    Thanks!
    Edited by: Maitreya2 on Mar 3, 2010 2:08 PM

    Thanks, adding '!' worked :)
    Do you know where i can read more about '!' and other special characters? I think i didn't see anything like that here: http://download.oracle.com/docs/cd/B14117_01/text.101/b10730/cqoper.htm#BABBJGFJ
    I also started using JARO_WINKLER_SIMILARITY function that is actually better i think for what i do. But it's very buggy - sometimes Oracle crashes and kills connection when you try to use it.
    Ahha, it's here: http://download.oracle.com/docs/cd/B19306_01/text.102/b14218/cqspcl.htm
    So, ! is soundex. Whatever it means..
    Edited by: Maitreya2 on Mar 5, 2010 12:14 PM

  • I have a macbook pro version 10.7.5 and my mailbox will not open at all and comes up with a quit message even though it is not open. how can i get into my account. it works on my iPhone an i have internet and all other functions working on my computer

    I have a macbook pro version 10.7.5 and my mailbox will not open at all and comes up with a quit message even though it is not open. how can i get into my account. it works on my iPhone and i have internet and all other functions working on my computer

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the name of the crashed application or process in the Filter text field. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    In the Console window, look under User Diagnostic Reports (not "Diagnostic and Usage Messages") for crash reports related to the crashed process. The report name starts with the name of the process, and ends with ".crash". Select the most recent report and post the entire contents—the text, not a screenshot. I know the report is long. Please post all of it anyway.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report—they're very long and rarely helpful.

  • SharePoint 2010 Search "Did You Mean" | How does it work?

    My customer has raised a concern that "Did you mean" functionality works inconsistently and issue is explained as below:
    1. When I search for misspelled word such as "Maketting" , search page displays the option "Did you mean ""Marketting"?
    2. When I search for another misspelled word "Marktng", I get no result and no "Did you mean" option.
    I believe there is a dictionary which maintains the mapping between misspelled word and the correct words but I was unable to track the location whether it is in database or a file system. Has anyone faced this issue and know the solution? Below article
    talks about a "Dictionary lexicon" but not sure about the location in SharePoint 2010 farm.
    http://www.petestilgoe.com/2009/10/sharepoint-search-how-features-work-part-1/
    Thanks and Regards
    -DB
    DB

    Hi Deepak,
    “Do you mean” functionality is enabled by selecting Query Suggestions in Search Box web part.
    Suggestions are automatically built based on what search results are actually clicked on. It takes 6 clicks within a year for SharePoint to add a suggestion.
    However, if an administrator needs to add a suggestion manually this can be done using the SharePoint 2010 Management Shell (PowerShell).
    I recommend to use PowerShell to check all the suggestions in the Search Service Application, and then remove the one that you do not need.
    $ssa=Get-SPEnterpriseSearchServiceApplication
    Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApp $ssa
    Remove a suggestion, such as “Marketting”:
    $ssa=Get-SPEnterpriseSearchServiceApplication
    Remove-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $ssa -Language En-Us -Type QuerySuggestionAlwaysSuggest -Identity "
    Marketting "
    More references about the query suggestion:
    http://blogs.technet.com/b/chad/archive/2010/06/24/tip-34-adding-a-sharepoint-2010-search-suggestion.aspx
    http://sharepointfieldnotes.blogspot.jp/2011/09/sharepoint-2010-search-query.html
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • Iv bought a touchpad app for my iPhone 5 to use on my Mac mini, all the functions work accept the zoom one, how can I fix this problem

    Iv bought a touchpad app for my iPhone 5 to use on my Mac mini, all the functions work apart from the zoom one. How can I fix this please

    Iv bought a touchpad app for my iPhone 5 to use on my Mac mini,''
    Considering the app for the iPhone is for iOS, you may have problems using it on the Mac (Mac OS X)
    Two different operating sysems.
    From iTunes for the touchpad app:
    Requirements: Compatible with iPhone, iPod touch, and iPad. Requires iOS 5.1 or later. This app is optimized for iPhone 5.
    From here >  https://itunes.apple.com/us/app/touchpad/id297623931?mt=8

  • How do you reactivate the grey utilities scroll up tab at the bottom of the screen that should reveal wifi, bluetooth etc? Doesn't matter what orientation the ipad is in, it won't scroll up from the bottom. All other screen functions work normally.

    How do you reactivate the grey utilities scroll up tab at the bottom of the screen that should reveal wifi, bluetooth etc?
    Doesn't matter what orientation the ipad is in, it won't scroll up from the bottom.
    All other screen functions work normally.

    Settings/Control Center. There are two options which are pretty self-explanitory...one enables/disables access on the Lock Screen and one enables/disables access within apps/games.

  • How does the SignatureClear() function work?

    Hello everyone:
    I have read Javascript for Acrobat API Reference (8.0) and I'm still wondering how SignatureClear() works. Is it possible to clear a signature field with this? How? It is said that you can not work with it in Adobe Reader... but I have seen some other functions working despite of the Availability column: is it possible to use it in Reader?
    Code examples will be very appreciated.
    Regards,
    Javier

    Javier
    I have not reviewed thew API documentation, but I can comment...
    1)  To "clear" or remove a digital signature, you need to have access to the "private" key (digital credential\certificate) that was used to generate the signature.  This means that typically, only the signer can remove their own signature.
    2)  You cannot sign a PDF document with Reader, UNLESS the PDF has been "reader extended" with the "signing" permission that will enable the ability to sign a document with Reader.  A PDF can be extended with LiveCycle Reader Extensions (server product) or with Acrobat Professional.  I have nottried it myself, but I would assume that the "signing" permission would need to be enabled on the document to allow Reader to remove (clear) the signature, assuming agaion that Reader had access to the private key used to create the signature.
    Hope this helps.
    Steve

  • How E-mail functionality works with Interaction Center Webclient

    Dear all,
    How the E-mail functionality works with IC Webclient, How can we can send and receive E-mails to customers and internal employees through Interaction Center.
    Does SMTP server required to be involved for this functionality or External Telephony system Vendor iprovides this function.
    What is ERMS? and why we use this in IC Webclient.
    Please educate me to understand the concept of E-mail functionality in IC Webclient.
    Your help will be highly appreciated.
    Best wishes,
    Raghu ram.

    Hello Raghu ram,
    The SAP CRM Interaction Center uses a concept of a shared email inbox for agent teams. This allows customers to communicate with your Interaction Center by sending emails to a corporate email address like service@yourcompany. You typically group your agents together into queues based on a particular product or skillset. Using this concept, customer's don't send emails directly to a specifc agent's email address, and agent's don't send emails directly to each other. That would rather still be done with groupware products like Microsoft Outlook.
    You have three options for routing emails into the CRM Interaction Center. You can push emails real-time to agents via a screen pop using third-party contact-center software like SAP BCM, Genesys, Avaya, and so on. Or there are two options for sending emails into the agent inbox, where the emails are processed in offline mode by agents, technicians, and engineers. You can route emails directly to a specific inbox group/queue by using different emails addreses. Or, you can leverage ERMS to decide where which agents to route the email to based on business rules.
    Please see the various notes mentioned above that appear in the sticky note on top of this forum. For example, there is a nice 85 page FAQ document on the Agent Inbox in note 882653. And ERMS note 940882 is also very useful.
    Regards,
    John

Maybe you are looking for

  • Installing PyMSNt on Snow Leopard Server 10.6

    OK, it's that time again, new OS X Server release and thus, new efforts to get PyMSNt running. Firstly, make sure you have the latest Developer Tools (XCode) installed. Also, assume that all of these commands need to be run as root, so you can prefix

  • Migrate script to Smartforms

    Hello , <b>Background :</b> 1) After I migrate Script to smartforms . I get around 200 windows . As 200 windows have been defined in a script .( 1 window per box). 2) The layouts are pretty complex and it would take around 2-3 days to create a new sm

  • HT3529 my imessage isnt working, any ideas?

    My imessage is not working, it wont activate.  Any ideas?

  • How to control Payment Block field at line item level

    Hi Experts, Could anyone please let me know how to control payment block and payment method fields at line item level. I have checked field status at posting key (OB41) and GL (OB14) level but didn't get any parameter to control these fields. I need

  • No songs yet on iPhone. All songs duplicated in Library. Delete/re-Add OK?

    OK. I am a beginner, so I understand NOTHING. This is probably a VERY basic question. I use a PC - not a Mac. Here's my situation: My iPhone was having problems so Apple tech has me totally reset it. The initial reset put my Contacts back on my iPhon