vim配置使用总结
2013-08-26 15:20
459 查看
在配置environment中加入
Ultrasphinx::Search.excerpting_options =
HashWithIndifferentAccess.new({
:before_match => '<span style="font-weight:bold;color:red">',
:after_match => '</span>',
:chunk_separator => "...",
:limit => 256,
#s:around => 2, # This doesn't seem to work.
:content_methods => [['title'], ['body', 'description', 'content']]
})
在搜索的article.rb中修改搜索方法
def self.my_search(search)
# find(:all, :conditions => ['body LIKE ? OR title LIKE ? OR description LIKE ?', "%#{search}%","%#{search}%","%#{search}%"])
my_search_result = Ultrasphinx::Search.new(:query=>search)
my_search_result.run
my_search_result.excerpt
end
最后返回的是excerpt
测试
a=Ultrasphinx::Search.new(:query=>'new')
a.run
a.excerpt
Ultrasphinx::Search.excerpting_options =
HashWithIndifferentAccess.new({
:before_match => '<span style="font-weight:bold;color:red">',
:after_match => '</span>',
:chunk_separator => "...",
:limit => 256,
#s:around => 2, # This doesn't seem to work.
:content_methods => [['title'], ['body', 'description', 'content']]
})
在搜索的article.rb中修改搜索方法
def self.my_search(search)
# find(:all, :conditions => ['body LIKE ? OR title LIKE ? OR description LIKE ?', "%#{search}%","%#{search}%","%#{search}%"])
my_search_result = Ultrasphinx::Search.new(:query=>search)
my_search_result.run
my_search_result.excerpt
end
最后返回的是excerpt
测试
a=Ultrasphinx::Search.new(:query=>'new')
a.run
a.excerpt
相关文章推荐
- Linux系统编程学习之《vim配置与使用总结》
- vim/vimdiff+cscope+ctags配置及使用总结
- bash alias, VIM配置,和使用的插件 RAILS开发相关
- 使用ubuntu16.04配置linux内核和busybox出现错误的解决方法总结
- Django在使用mod_python+apache中配置VirtualHost的问题总结
- Java之Eclipse的使用、优化配置—总结
- 使用HADOOP演示MAPREDUCE配置总结
- 个人总结的Struts2拦截器使用和拦截栈的配置,基于注解的方式
- 使用ivim配置vim
- 工作总结---检测认证(配置tomcat使用https)
- 在 Windows 下配置 Vim 使用 Ack 进行快速查找
- jspwiki配置和使用总结
- 工作总结-Xcode7中使用静态库环境配置手册
- C#各种配置文件使用,操作方法总结
- vim + ctags + taglist配置和使用
- [学习总结]9、Android-Universal-Image-Loader 图片异步加载类库的使用(超详细配置)
- vim配置总结
- QT的安装配置和使用总结(不定时更新)
- vim集成开发环境搭建之ctags配置使用
- Vim编辑器使用总结