$Search 在 odata 网络中不工作 api 2

$Search not working in odata web api 2

我无法确定如何让 $search 参数在 odata 中进行全文搜索。

后面的url表示应该包含在6.1中 http://blogs.msdn.com/b/odatateam/archive/2014/03/21/odata-6-1-and-odata-client-6-1-are-now-shipped.aspx

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

当我执行 odata 查询时 http://localhost:53621/odata/PartnerMaster?%24format=json&%24top=100&%24orderby=PartnerName&%24search=Test

我收到错误消息。 message=不支持查询参数'$search'

:) 再见。复制这里的答案让更多人知道。

ODL 支持解析 $search 查询选项,但是 Web APIOData 目前还不支持。

而在ODL中,您可以参考以下测试用例:

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