04.06.2019, 14:11 | #1 |
Участник
|
crmtipoftheday: Tip #1270: Table or view is not full-text indexed
Источник: https://crmtipoftheday.com/1270/tabl...-text-indexed/
============== Today’s tip is from Marius Agur Hagelund “Viking” Lind (actually, I’m confused, perhaps it’s Marius “Viking” Agur Hagelund Lind?). Got a tip of your own? Send it to jar@crmtipoftheday.com. Cannot use CONTAINS or FREETEXT predicate on table or indexed view because it is not full-text indexedIf you’veever got this error message it’s probably because you tried searching using theSDK using the contains keyword on a field which isn’t full-text indexed. For me it was searching for systemusers: nameSearch.Criteria.AddCondition("firstname", ConditionOperator.Contains, searchString);I got the following nice error message in return,which puzzled me at first Cannot use a CONTAINS or FREETEXT predicate on tableor indexed view 'SystemUserBase' because it is not full-text indexed.I triedchecking in the system, and found that I could search for names there when Iused wildcard characters, and then it dawned on me that all these years ofautocomplete, intellisense and helpers have made my lazy and dumb. Usingwildcards is not the same as using CONTAINS, which is very obvious if you takea SQL Server 101 course found anywhere, so the solution was as easy as this: nameSearch.Criteria.AddCondition("firstname", ConditionOperator.Like, $"%{searchString}%");But what about the web api? Well, turns out they removed the Microsoft.Dynamics.Crm.Contains action and only use the Contains keyword (api/data/v9.1/systemusers?$contains(firstname, ‘mike d’). That is, unless you want to perform a full-text search in knowledge base articles: https://docs.microsoft.com/en-us/dyn...ics-ce-odata-9 So lesson learned: Stop being a dinosaur and start using the web api. Viking out. Cover photo by unsplash-logoDaiga Ellaby Источник: https://crmtipoftheday.com/1270/tabl...-text-indexed/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|