admin管理员组文章数量:1391937
I am trying to implement a search in ColdFusion (with indexing through Solr) where it gets a match on exact substrings and exact substrings only.
Here's my sample code:
<cfset criteriaString = '*#ARGUMENTS.query_term#*' />
<cfsearch
name="searchResults"
criteria="#criteriaString#"
collection="#courseCollection#"
suggestions="always"
maxrows="1500"
>
Where ARGUMENTS.query_term
is the string that the user searches for. I have a full string of tomato
and this search works great for that - if I search t
, oma
, tomat
, or tomato
, it finds it perfectly with the *
wildcard.
This doesn't work, however, with spaces. I have another string tomato project
, and if I search for tomato pro
or ato p
, it doesn't work.
I tried escaping the space by doing this to my criteriaString
:
<cfset criteriaString = '*#replace(ARGUMENTS.query_term, ' ', '\ ', 'all')#*' />
But that didn't work. I also tried adding quotes around the query term instead:
<cfset criteriaString = '"#replace(ARGUMENTS.query_term, ' ', '\ ', 'all')#"' />
But that didn't work either.
For what it's worth, I believe the tokenizer being used on the fields in my index is the White Space Tokenizer (.html). Any guidance would be greatly appreciated.
本文标签: How to get an exact substring match search with wildcards for Solr in ColdFusionStack Overflow
版权声明:本文标题:How to get an exact substring match search with wildcards for Solr in ColdFusion? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744684268a2619601.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论