我在我的门户网站(基于J2EE)中使用Lucene进行索引和搜索服务.
问题是关于Lucene的关键字.当您在搜索查询中使用其中一个时,您将收到错误.
例如:
searchTerms = "ik OR jij"
Run Code Online (Sandbox Code Playgroud)
这很好,因为它会搜索"ik"或"jij"
searchTerms = "ik AND jij"
Run Code Online (Sandbox Code Playgroud)
这很好,它搜索"ik"和"jij"
但是当你搜索:
searchTerms = "OR"
searchTerms = "AND"
searchTerms = "ik OR"
searchTerms = "OR ik"
Run Code Online (Sandbox Code Playgroud)
等等,它将失败并出现错误:
Component Name: STSE_RESULTS Class: org.apache.lucene.queryParser.ParseException Message: Cannot parse 'OR jij': Encountered "OR" at line 1, column 0. Was expecting one of: ...
这是有道理的,因为这些单词是Lucene的关键字可能是保留的,并将充当关键字.
在荷兰语中,"OR"这个词很重要,因为它对"Ondernemings Raad"有意义.它被用在许多文本中,需要找到它.例如,"或"确实有效,但不返回与术语"OR"匹配的文本.我怎样才能让它可以搜索?
如何逃避关键字"或"?或者,我如何告诉Lucene将"或"视为搜索词而不是关键词.
我需要WM_CONCAT在SQL Server中使用与Oracle类似的函数,它返回以逗号分隔的列表,其中包含您将其作为参数传递给它的任何字段.例如,在Oracle中,
select WM_CONCAT(first_name) from employee where state='CA'
Run Code Online (Sandbox Code Playgroud)
返回"约翰,吉姆,鲍勃".
我怎么能在SQL Server中执行此操作?
谢谢