zoukankan      html  css  js  c++  java
  • sunspot solr 小青年

    Gemfile

    gem 'sunspot_rails'

    gem 'sunspot_solr'

    然后执行

    bundle

     之后就是rails g sunspot:solr:install生成一个config/sunspot.yml文件,不需要管理这个生成文件

    然后执行

    bundle exec rake sunspot:solr:start

    class Post < ActiveRecord::Base   
    searchable do
    text :title, :body
    text :comments do
    comments.map { |comment| comment.body }
    end
    boolean :featured
    integer :blog_id
    integer :author_id
    integer :category_ids, :multiple => true
    double :average_rating
    time :published_at
    time :expired_at
    string :sort_title do
    title.downcase.gsub(/^(an?|the)/, '')
    end
    end
    end

    bundle exec rake sunspot:solr:reindex

    参考: https://github.com/sunspot/sunspot

  • 相关阅读:
    terminal
    变量提升、函数提升
    ssh传输文件
    mocha测试框架
    npm-run 自动化
    webpack
    浅析babel
    构建工具gulp
    C++中TRACE宏及assert()函数的使用
    memcpy函数-C语言
  • 原文地址:https://www.cnblogs.com/perish/p/2779317.html
Copyright © 2011-2022 走看看