$ SEARCH没有OData的网页API 2个工作($Search not working in

2019-10-24 01:13发布

我无法确定如何获得$搜索参数,为在OData的全文搜索工作。

以下网址表明,它应包含在6.1 http://blogs.msdn.com/b/odatateam/archive/2014/03/21/odata-6-1-and-odata-client-6-1-are -现在,shipped.aspx

我创建了使用以下模板一个示例应用程序http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-端点

当我执行的OData查询的http://本地主机:53621 /的OData / PartnerMaster%24format = JSON&%24top = 100&%24orderby = PartnerName&%24search =测试

我收到错误消息。 消息=查询参数“$搜索”不支持

Answer 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



文章来源: $Search not working in odata web api 2