$搜索在OData Web API 2中不起作用 [英] $Search not working in odata web api 2

查看:103
本文介绍了$搜索在OData Web API 2中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定如何获取$ search参数以在odata中进行全文搜索.

以下网址表示应将其包含在6.1中 http://localhost:53621 /odata/PartnerMaster?%24format = json&%24top = 100&%24orderby = PartnerName&%24search = Test

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

解决方案

:)再见.在此处复制答案,以使更多的人意识到这一点.

ODL支持解析$ search查询选项,但是,到目前为止,Web API OData还不支持该选项.

在ODL中,您可以引用以下测试用例:

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

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

解决方案

:) 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

这篇关于$搜索在OData Web API 2中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆