怎样才能做一个不变的.Contains(myQuery)与Linq的对象?(How can do an invariant .Contains(myQuery) with Linq to Objects?)
我试图用linq过滤一个对象列表。 当我通过
Contains(someSearchQuery)
过滤时,它就像区分大小写一样。这意味着我错过了一些结果。
我有一个
IList<Foo>
,它有很多属性,但其中一个是public string MyText { get; set; }
public string MyText { get; set; }
现在,我试图返回一个IQueryable的Foo的MyText属性包含
search query
- 但作为一个如果这是一个Sql语句,它将是..
WHERE MyText LIKE '%searchQuery%'
< - 工作但不合法要么
WHERE CONTAINS(MyText, 'searchQuery')
< - 使用FTS。我不知道如何做到这一点,因为当我做下面的查询时,就像是在区分大小写
var query = from q in myFooList.AsQueryable().Where(x => x.MyText.Contains(searchQuery));
建议?
I'm trying to filter a list of objects using linq. When i filter by a
Contains(someSearchQuery)
it's like it's being case sensitive .. meaning i miss some results.
I have an
IList<Foo>
's which has a number of properties, but one ispublic string MyText { get; set; }
Now, i'm trying to return a IQueryable of Foo's where the MyText property contain the
search query
- but as a If this was a Sql statement, it would be either..
WHERE MyText LIKE '%searchQuery%'
<-- Works but inefficentor
WHERE CONTAINS(MyText, 'searchQuery')
<-- using FTS.I'm not sure how to do this, because when I do the following query it's like it's doing a case sensitive
var query = from q in myFooList.AsQueryable().Where(x => x.MyText.Contains(searchQuery));
Suggestions?
原文:https://stackoverflow.com/questions/3872231
最满意答案
您需要在context.xml文件中定义一个链接,以将webapp使用的名称映射到全局名称,即使名称相同也是如此。
请参阅http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Resource_Links
You need to define a link in the context.xml file to map the name used by the webapp to the global name, even if the name is the same.
See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Resource_Links
相关问答
更多-
您需要在context.xml文件中定义一个链接,以将webapp使用的名称映射到全局名称,即使名称相同也是如此。 请参阅http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Resource_Links You need to define a link in the context.xml file to map the name used by the webapp to the global name, even if the nam ...
-
获得该异常的唯一方法是将null传递给Class.forName(),或者通过使用损坏的JVM。 您显示的代码不能抛出该异常。 仔细检查您的结果。 在最坏的情况下,您应该得到ClassNotFoundException 。 也许您已经更新了代码但尚未编译和重新部署它,所以您仍然可以看到服务器中运行旧代码的结果。 The only way you can get that exception is by passing null to Class.forName() or maybe by having a ...
-
在进一步检查日志后,我意识到我在context.xml中的资源定义中有一个格式错误的URL,我将其更改为: url="jdbc:sqlserver:server/instance:port;databaseName=dbname;" 对此: url="jdbc:sqlserver://server\instance:port;databaseName=dbname;" Upon further inspection of the logs I realized that I had a malformed ...
-
没有合适的驱动程序意味着当您尝试运行时,它无法使用驱动程序找到.jar文件。 在重新安装mac os之前,你的驱动程序(jar文件)以某种方式链接到你的程序。 我的假设是这个驱动程序被删除或移动,现在你的程序找不到它。 你是如何建立自己的计划的? 有Maven还是其他建筑商? 像Maven这样的建造者可以为你处理这样的事情。 无论如何,在intelliJ中,再次将您的驱动程序添加到项目中。 以下是您可以在intelliJ中配置和添加驱动程序的屏幕(数据源和驱动程序屏幕)。 在第一步中,您可以在左上角添加绿色 ...
-
Tomcat自动将容器管理的连接池添加到jaxaz.sql.DataSource类型的每个资源。 提供此池的库(Commons DBCP的包重命名版本)由共享类加载器加载(在默认配置中与公共加载器相同)。 池实现需要能够加载已配置的JDBC驱动程序,并且共享(和公共)加载器无法查看Web应用程序类加载器。 因此,带有JDBC驱动程序的JAR需要位于$CATALINA_BASE/lib目录中,以便可以加载它。 但是,从r754776开始 ,如果DBCP无法加载指定的驱动程序,它将回退到Thread的上下文类加 ...
-
使用Tomcat 8上的jTDS JDBC驱动程序的AbstractMethodError(AbstractMethodError with jTDS JDBC Driver on Tomcat 8)[2023-11-27]
原来我不得不补充: validationQuery="select 1" 在context.xml中的资源声明中。 这里提到了这一点(虽然拼错为validateQuery )。 挖掘JtdsConnection的实现可以看到: /* (non-Javadoc) * @see java.sql.Connection#isValid(int) */ public boolean isValid(int timeout) throws SQLException { // TODO Auto-gene ... -
使用JNDI提供程序时,请勿使用dataSourceClassName (或dataSource.URL )属性。 如果需要,使用jdbcUrl和driverClassName (但首先尝试不使用它)。 context.xml was not being put into the META-INF folder
-
无法为连接URL'null'Oracle创建类''的JDBC驱动程序(Cannot create JDBC driver of class '' for connect URL 'null' Oracle)[2022-11-25]
问题在于文件名。 我的应用程序WAR名称是“TomcatExample.war”,xml名称是“tomcatexample.xml”。它在tomcat 7中区分大小写,这就是它没有提取文件的原因。 对“TomcatExample.xml”的更改对我有用。 非常感谢你的帮助。 干杯!!! The issue was with the filename. My application WAR name was "TomcatExample.war" and xml name was "tomcatexample ... -
这解决了它: 在Server.xml中添加了上下文中的资源行,为什么需要定义两次? 有什么线索吗?错误说Could not load JDBC driver class [com.mysql.jdbc.Driver] 。 我没有在您的库列表中看到MySQL连接器,因此将其添加到您的pom.xml :
mysql mysql-connector-java 5.1.31 相关文章
更多- Guava Objects类详解
- 利用Linq + Ajax 异步分页实现单个删除,批
- 自己定义的vo对象比较,应该如何实现才能做到高效?
- Json.Net学习笔记
- There is already an open DataReader associated with this Connection which must be closed first
- 终于把你必须知道的.NET看完了
- 我们能做什么样的Android应用
- 确定还能做室友么?
- Scott Hanselman's 推荐的的实用工具集合(2011版)
- Scott Hanselman's 推荐的的实用工具集合(2011版)
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。