首页 \ 问答 \ SOLR子串搜索使用sunspot_rails和heroku(SOLR substring search using sunspot_rails and heroku)

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
更新时间:2022-05-15 07:05

最满意答案

默认情况下, 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 ]] )

相关问答

更多
  • 如果您在浏览器中向该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

    '; echo $_SERVER['REMOTE_ADDR']; ?> 希望这是有道理的,否则如果你想显示给用户,另一种 ...
  • 我解决了这个问题 - 问题是我没有在ajax调用所属的onclick处理程序中返回false。 我在这里读到这个: jQuery Ajax请求在没有发送的情况下被取消 I solved this - the problem was that I was not returning false in the onclick handler that the ajax call was a part of. I read this here: jQuery Ajax requests are getting c ...
  • 您已通过声明: 显然,在模板的#each-part完成之前或数据到达之前,都会调用Template.featuredCarousel.rendered中的函数。 模板的rendered回调仅在模板实例首次插入DOM时调用一次,因此如果您的数据尚未就绪(从服务器获取),则#each块将不会生成任何HTML元素,并且当您实例化时旋转木马它会显得空洞。 您可以做的是确保在rendered回调触发之前您的数据已准备就绪。 显然你试图设置这个解决方案没有运气,你确定你添加了这样的默认加载钩子吗? Router.onB ...
  • 问题解决了,解决方案:我们可以在Exchange服务器上为特定的电子邮件ID添加一个属性,该电子邮件ID将仅以文本/纯文本形式发送电子邮件。 所以现在我发送一封HTML电子邮件然后交换服务器将其转换为纯文本电子邮件。 problem solved, solution: we can add a property on exchange server for particular email id that this email id will get email in text/plain form onl ...
  • 默认情况下, 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 sen ...
  • 您不能使用呈现的属性执行此操作,但您可以使用页面加载上的javascript来隐藏您不希望显示的字段,方法是将其显示样式属性设置为none。 You can't do this with the rendered attribute, but you could use javascript on page load to hide fields which you don't want to display by setting their display style attribute to none. ...
  • 请注意,您可以根据需要更改模型对象名称。

    {{name}}

    请将你的js代码与angular合并,然后进行调试,如下所示