$Search not working in odata web api 2

三世轮回 提交于 2019-12-11 13:13:53

问题


I am unable to determine how to get $search parameter to work for full text search in odata.

The following url indicates that it should be included in 6.1 http://blogs.msdn.com/b/odatateam/archive/2014/03/21/odata-6-1-and-odata-client-6-1-are-now-shipped.aspx

I have created a sample application using the following template http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint

When I execute the odata query http://localhost:53621/odata/PartnerMaster?%24format=json&%24top=100&%24orderby=PartnerName&%24search=Test

I receive the error message. message=The query parameter '$search' is not supported


回答1:


:) See you again. Copy the answer here to let more people aware of it.

ODL supports to parse the $search query option, however, Web API OData doesn’t support it so far.

While, in ODL, you can refer the following test cases:

https://github.com/OData/odata.net/blob/master/test/EndToEndTests/Tests/Client/Build.Desktop/TripPinServiceTests/TripPinServiceTests.cs#L515-L576

https://github.com/OData/odata.net/tree/ae0dd29c1cf430255a8ec9c4225b4745e25cad64/test/FunctionalTests/Tests/DataOData/Tests/OData.Scenario.Tests/UriParser/Search

https://github.com/OData/odata.net/tree/ae0dd29c1cf430255a8ec9c4225b4745e25cad64/test/FunctionalTests/Tests/DataOData/Tests/OData.Scenario.Tests/UriParser/SearchCombination



来源:https://stackoverflow.com/questions/31527180/search-not-working-in-odata-web-api-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!