none
How do you use the SearchTerm property of EntityMembersGetCriteria? RRS feed

  • Question

  • This is described as the where clause which allows you to filter the members you want to retrieve. There seem to be some restrictions on what you can enter here. Some guidance would be very useful.

    John.

    Thursday, August 26, 2010 6:37 PM

Answers

  • Hello woaksie

    I saw an example in the comments of

    http://sqlblog.com/blogs/mds_team/archive/2010/04/21/updated-product-documentation-and-resources.aspx

    here it is:

    Alexey Gudzera said:

    Well, I've got the idea! Sometimes it takes to use Reflector to realize that estimated syntax of SearchTerm is dumb!!!

    Well, for everyone who wants to know how to use SearchTerm here goes an example:

      request.MembersGetCriteria.SearchTerm = String.Format(" [Name] MATCH '{0}' 0.5 1 0.32 ", searchRequest.MemberNameToSearchFor);

    Here:

    [Name] means name of the column to search in.

    MATCH means mdq.Simplicity function

    {0} is your string to search for

    0.5 is minSimilarity which means minimum matching score of element to be returned

    1 means method to use

    0.32 means how exact method will be.        


    Xavier Averbouch
    Friday, August 27, 2010 10:00 AM
    Moderator
  • Well, my example above was about implementing fuzzy search via MDS WCF-services.  

    According to my research SearchTerm is used as WHERE clause, but in order to prevent SQL-injections MDS developers decided to parse it first by themselves before using it in a query. So in reality this field power is limited by just a few allowed operators like AND, = , LIKE. Where is also some synonyms for special MDS SQL-functions like mdq.Similarity which allows us to perform some fuzzy search (synonym for mdq.Similarity is MATCH ).

    Friday, September 3, 2010 4:55 AM

All replies

  • Hello woaksie

    I saw an example in the comments of

    http://sqlblog.com/blogs/mds_team/archive/2010/04/21/updated-product-documentation-and-resources.aspx

    here it is:

    Alexey Gudzera said:

    Well, I've got the idea! Sometimes it takes to use Reflector to realize that estimated syntax of SearchTerm is dumb!!!

    Well, for everyone who wants to know how to use SearchTerm here goes an example:

      request.MembersGetCriteria.SearchTerm = String.Format(" [Name] MATCH '{0}' 0.5 1 0.32 ", searchRequest.MemberNameToSearchFor);

    Here:

    [Name] means name of the column to search in.

    MATCH means mdq.Simplicity function

    {0} is your string to search for

    0.5 is minSimilarity which means minimum matching score of element to be returned

    1 means method to use

    0.32 means how exact method will be.        


    Xavier Averbouch
    Friday, August 27, 2010 10:00 AM
    Moderator
  • Hi Xavier,

     

    I saw that too. I found that setting the SearchTerm to a value like "SomeAttribute = 'SomeValue'" works. I have tried dates, strings, numbers and if it is a domain based attribute you can use the Code value. I also found the LIKE operator works as in SQL. Logic AND works but not Logic OR. I tried Reflector and the SQL Profiler but didn't really learn too much. It looks like it is resolving the attribute name at some point.

    What really is needed here is some good documentation!!

    Thanks for the reply.

    John.

    Friday, August 27, 2010 9:02 PM
  • Well, my example above was about implementing fuzzy search via MDS WCF-services.  

    According to my research SearchTerm is used as WHERE clause, but in order to prevent SQL-injections MDS developers decided to parse it first by themselves before using it in a query. So in reality this field power is limited by just a few allowed operators like AND, = , LIKE. Where is also some synonyms for special MDS SQL-functions like mdq.Similarity which allows us to perform some fuzzy search (synonym for mdq.Similarity is MATCH ).

    Friday, September 3, 2010 4:55 AM