SOLR子串搜索使用sunspot_rails和heroku(SOLR substring search using sunspot_rails and heroku)
我最近修改了我的schema.xml(正如sunspot wiki中的这篇文章所建议的那样)来帮助进行子字符串搜索。 这在当地很有效。 但在推动生产和重新索引之后,这些变化似乎没有生效(即子串匹配似乎不起作用)。 换句话说,如果我使用相同的字符串(即“Mastercard”)并在本地搜索“Ma”,我会得到一个“Mastercard”字符串...但是在制作时,我什么也得不到。 我在heroku上使用sunspot_rails gem。
I recently altered my schema.xml (as suggested by this post in the sunspot wiki) to help with substring searching. This works great locally. But after pushing to production and reindexing, the changes don't appear to have taken effect (i.e. substring matching doesn't seem to work). In other words, if I take the same string (i.e. "Mastercard") and search "Ma" locally, I get a "Mastercard" string as a result... but on production, I don't get anything. I'm using the sunspot_rails gem on heroku.
原文:https://stackoverflow.com/questions/22802859
最满意答案
默认情况下,
Web->minify
函数发送Content-Type HTTP标头。 为了防止出现这种情况,您应该将第三个参数设置为FALSE:\Web::instance()->minify($filepaths,NULL,FALSE)
注意: 完整的功能签名是:
minify ( string|array $files [, string $mime = NULL [, bool $header = TRUE ]] )
By default the
Web->minify
function sends a Content-Type HTTP header. In order to prevent this behaviour, you should set the third parameter to FALSE:\Web::instance()->minify($filepaths,NULL,FALSE)
NB: the complete function signature is:
minify ( string|array $files [, string $mime = NULL [, bool $header = TRUE ]] )
相关问答
更多-
cURL响应HTML以纯文本形式而不是呈现的HTML回显(cURL response HTML is echoed as plain text instead of rendered HTML)[2021-08-14]
如果您在浏览器中向该API端点发出POST请求,然后检查它在开发工具网络面板中的响应,您将看到API响应已在表单中 <html> <head> <title>Example Domain</title> etc. 因此,您从此API返回的不是“纯”HTML,而是使用特殊字符<和>编写为HTML实体的HTML - 这就是您显示代码而不是呈现结果的原因。 将html_entity_decode应用于您获得的字符串值,然后通过echo输出,将很容易解决此问题。 I ... -
自己找到了答案: 您可以使用javascript适配器。 例:让| varname | js | response.body | | 参考: https : //github.com/smartrics/RestFixture/issues/26 谢谢! Found the answer myself: You can use a javascript adapter for that. Ex: let | varname | js | response.body | | Reference: https: ...
-
好的,我加了一杯咖啡,答案来了。 您需要将视图链接到模板。 这是新的结构布局: 应用程序/ router.js this.route( '映射') 应用程序/控制器/ map.js 应用程序/模板/ map.hbs {{view id =“map”}} 应用/视图/ map.js build function(){}。on('didInsertElement') 实际上,模板渲染的控制是在View层而不是控制器中完成的。 据我所知,控制器的目标是用户交互。 Ok, I add a coffee and th ...
-
既然你提到你希望输出就像查看源代码一样,你可以简单地在脚本的开头声明内容类型为纯文本。 这会将输出呈现为文本,并且文本文件可以下载。 例如:
Hello helloooooo