sunspot 查询语法

2019-03-27 01:08|来源: 网路

demand_text:12

 

 

实际当中是字段demand,sunspot生成的时候会生成,demand_text

 

sunspot内置的solr的版本

http://127.0.0.1:8982/solr/admin/registry.jsp

Solr Specification Version: 1.4.0Solr Implementation Version: 1.4.0 833479 - grantingersoll - 2009-11-06 12:33:40Lucene Specification Version: 2.9.1Lucene Implementation Version: 2.9.1 832363 - 2009-11-03 04:37:25 Current Time: Thu Aug 18 14:41:47 CST 2011 Server Start Time:Thu Aug 18 13:29:12 CST 2011


转自:http://www.cnblogs.com/lexus/archive/2011/08/18/2144320

相关问答

更多
  • 我相信这与文本字段是否存储有关。 这是否有所作为: searchable do text :name, :stored => true ... 这就是在这个例子中:body字段的配置方式: http://github.com/outoftime/sunspot-rails-example/blob/master/app/models/post.rb 主体字段是在控制器中查询突出显示的字段: http://github.com/outoftime/sunspot-rails-example/ ...
  • 完成您所寻找的最佳方法是将回复的内容(以及您希望进行搜索的任何其他字段)非规范化为其父消息。 这在太阳黑子中非常简单。 您可能在网上进行研究的另一种常见情况是根据评论内容搜索博客帖子。 这里需要注意一点:由于非规范化,您需要一个after_save挂钩,以便在添加或更新时回复可以重新索引其父级。 在你的情况下,变化可能看起来像这样... class Message < ActiveRecord::Base # … after_save :reindex_parent searchab ...
  • Solr有(和太阳黑子支持)一个叫做“multiselect facets”的概念,这就是你在这里需要的。 基本上,你可以告诉Solr忽略一个条件(或多个条件),仅仅是为了计算某个方面。 所以你想在这里做的是: Sunspot.search(MyModel) do facet_restriction = with(:facet_id, params[:facet_id]) facet(:facet_id, :exclude => facet_restriction) end 希望有所帮助。 Sol ...
  • 我想到了。 这是正确的方法: searchable do . . . double :latitude double :longitude location (:location) { Sunspot::Util::Coordinates.new(latitude, longitude) } end I figured it out. Here's the correct way to do it: searchable do . . . double :latitude double :longitud ...
  • 这是你需要做的: facet :work_remotely if !include_remote with(:location).in_radius(latitude, longitude, DEFAULT_DISTANCE_IN_MILES, bbox: true) if latitude && longitude else #need to do a location with an OR include_remote any_of do ...
  • 乌韦是对的。 你不使用/需要RegEx,你使用通配符。 这应该有所帮助: 如何使用太阳黑子实现通配符搜索 Uwe is right. You dont use/need RegEx, you use wildcards. This should help: how to implement wildcard search with sunspot
  • 您可以在搜索方法中添加这样的代码 with(:lab, 'Support') 并在您的模型中添加此项 string :lab The solution was adding without in my gears_controller.rb file. gears_controller.rb def rack1 @gears = Gear.where("Lab like ? OR Lab like ? OR Lab like ?", "%Primary%", "%Mini%", "%Suppo ...
  • 您不能这样做,因为search块只是将参数传递给Solr来进行搜索。 如果你想纯粹在Solr中进行这种过滤(实际上它比使用数据库搜索更快),你需要索引可以看到每条记录的用户id: 在你可搜索的块中 integer :viewer_ids, references: User, multiple: true do some_method_that_returns_viewer_ids end 您还需要确保保存任何记录更改,这会触发重新索引。 You cannot do this because the s ...
  • 你不能只使用 Job.search do adjust_solr_params do |params| params.except! :fq end end 或类似的东西,以从params散列中删除:fq键 Can't you just use Job.search do adjust_solr_params do |params| params.except! :fq end end Or something similiar in order to remove the :fq ...
  • (仅对Solr部分发表评论,不确定SunSpot如何映射它) 这里有一些不太正确的事情: 因为Solr 4.4, side = back不再是一个选项,所以你可能只是获得了同一个过滤器的两个副本 无论如何,拥有相同过滤器的两个副本是不好的,因为第二个副本将查看第一个发布的所有令牌,事情将变得混乱。 这是匹配后缀的好方法,考虑到剥离所有随机的非数字内容和索引/查询的不对称性(来自我的AirPair Solr教程 ):