- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我继承了一个通过轮胎进行 Elasticsearch 的项目。
搜索正在运行,但重音通过它关闭。例如,搜索“this”需要返回“thís”和“thiš”。
我已阅读此轮胎文档:http://karmi.github.com/tire/
以及:http://railscasts.com/episodes/306-elasticsearch-part-1?view=asciicast
其中提到了 elasticsearch 的大部分选项都可以在 tire 中使用。
关于忽略重音的搜索,asciifolding 不断出现,但 Elasticsearch 只是这样说:
http://www.elasticsearch.org/guide/reference/index-modules/analysis/asciifolding-tokenfilter.html
此外,我还发现了一些关于过滤器/重音等的信息,例如:
https://github.com/elasticsearch/elasticsearch/issues/890
https://gist.github.com/2142635
但他们都在使用裸 Elasticsearch 选项。
当我尝试在我的 ruby 代码中使用 asciifolding 过滤器时,我收到关于没有为“asciifolding”定义的过滤器的错误。
这是在我的代码中完成的搜索的核心——我如何修改它以进行不区分重音的搜索。它是 asciifolding 吗?如果是,我该如何在这里声明它?
result = tire.search(:load => true,page: params[:page], per_page: params[:per_page] ) do
query { string "#{params[:term]}", :default_operator => 'and' } if params[:term].present?
filter :missing, :field => 'original_media_id' #see above
#asciifolding?
sort { by :updated_at, :desc } if params[:term].present?
facet 'files' do
terms 'indexed_files.file.id'
end
end
编辑:或者它应该在映射/索引中完成?然后重新运行索引器。这是映射,我尝试将 :filter => "asciifolding"放入一些索引,但这似乎不起作用(也没有产生任何错误输出):
tire.mapping do
indexes :id, :index => :not_analyzed
indexes :name, :filter => "asciifolding"
indexes :description, :filter => "asciifolding"
indexes :created_at, :type => 'date'
indexes :updated_at, :type => 'date'
indexes :file_type
indexes :indexed_files, :type => 'object' do
indexes :file, :type => 'object',
:properties => {
:title => {
:type => "multi_field",
:fields => {
:raw => { :type => 'string', :index => 'not_analyzed'},
:title => { :type => 'string', :filter => "asciifolding" }
}
},
:description => { :type => "string", :filter => "asciifolding" }
}
end
end
最佳答案
本文中有一个非常好的“asciifolding”示例(在索引文本时从标记中删除重音符号):Autocomplete with Tire
关于ruby - 使用 Elasticsearch 和轮胎忽略口音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10825242/
有没有一种相对简单的方法可以从希腊字符串中删除变音符号?例如,如果字符串是“Ο πανω όροφος”,我希望它变成“ο πανω οροφος”,仍然是希腊语,没有重音。我想避免字符串替换,因为它
有没有一种相对简单的方法可以从希腊字符串中删除变音符号?例如,如果字符串是“Ο πανω όροφος”,我希望它变成“ο πανω οροφος”,仍然是希腊语,没有重音。我想避免字符串替换,因为它
我遇到了一些问题,我想知道是否有人可以帮助我。 我将我的网站和数据库设置为 utf8。当我在查询字符串部分输入重音符时出现问题 ã 变成 %E3,但如果我在页面中使用链接或表单,它会给出 % C3%A
我的 PHP/JavaScript 和口音有问题。当我给出一个包含重音符号的变量时,JavaScript 的控制台会显示:未捕获的语法错误意外的标识符。 PHP: foreach($credit as
我想使用 matplotlib 中默认的 sans-serif 字体来编写绘图标题,其中必须包含一个“ä”,德语 a-umlaut。如果发现通常在 python 中,这是通过在开头声明 # -*- c
我需要编写一个服务器端函数来清理 URL 编码字符串。 示例查询字符串: FirstName=John&LastName=B%F3th&Address=San+Endre+%FAt+12%2F14 当
假设我们设置并使用类似于 documentation 的 Angular i18n 标签: Hello World 我们使用 ng xi18n --i18nFormat=xlf 生成我们的翻译 到目前
问题 我的 Hive 表在某些行值中包含特殊字符(法语)时遇到了很多问题。基本上,在查询数据(通过 Hive CLI 或其他方法)时,所有特殊字符(如字母或其他变音符号上的重音)都会变成纯粹的乱码(各
这个问题在这里已经有了答案: Complex "Contains" string comparison (1 个回答) Ignoring accented letters in string com
我有一个问题。我尝试插入以下文本,在文本框中找到它。 Le développement durable (anglais*:*sustainable development, parfois trad
我正在寻找在 rereplace() 中使用的正则表达式模式将保留 URL 安全字符的函数,但包括带重音符号的 UTF-8 字符。例如:ç和 ã . 类似:url = rereplace(local.
情况如下: 我正在向我的设备发送远程事件(我可以完全访问它)。这个事件是关键事件,所以我将它们直接注入(inject)/dev/input/event* 我正在做一个键盘,我成功地发送了普通键 A-Z
我是一名优秀的程序员,十分优秀!