CSC/ECE 517 Spring 2015/ch1b 18 AS: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on <ref>http://lucene.apache.org/index.html</ref>Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on <ref>http://lucene.apache.org/index.html</ref>Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.


= Installation =


Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.
<div class="code_block">
        <div class="code_header">
          /Gemfile
        </div>
        <div class="CodeRay">
  <div class="code"><pre>source <span class="s"><span class="dl">'</span><span class="k">http://rubygems.org</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">rails</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">3.0.9</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">sqlite3</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">nifty-generators</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">sunspot_rails</span><span class="dl">'</span></span></pre></div>
</div>
      </div>
<pre>
gem 'sunspot_rails'
</pre>
You could install pry on Rails by adding the pry-rails gem to your gem file:
<pre>
group :development do
  gem 'pry'
  ...
end
</pre>
Once you have got that settled, change back into the sample_app directory and install all the necessary dependencies:
<pre>
bundle install
</pre>
Setting up the database:
<pre>
rake db:schema:load
</pre>
Note that some of you might need to prefix the above command with bundle exec.
One final thing before we proceed to the actual stuff: Create .pryrc in your home directory and fill it in with the editor of your choice:
<pre>
% touch ~/.pryrc
Pry.config.editor = 'vim'
</pre>
To launch pry through the terminal you simply write:
<pre>
rails c
</pre>
and you’re greeted with a pry console:
<pre>
% rails c
Loading development environment (Rails 3.2.16)
Frame number: 0/3
[1] sample_app »
</pre>
=='''References'''==
=='''References'''==
<references/>
<references/>

Revision as of 10:33, 17 February 2015

Apache Solr and Rails


Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on <ref>http://lucene.apache.org/index.html</ref>Apache Lucene search library. Websites using Rails can take advantage of the Solr search engine to provide sophisticated and customizable search features. Ruby/Rails integrates with Solr search server using Sunspot (sunspot, sunspot_rails gem) library, to do a full-text search.

Introduction

Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on <ref>http://lucene.apache.org/index.html</ref>Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.

Installation

Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.

         /Gemfile
source <span class="s"><span class="dl">'</span><span class="k">http://rubygems.org</span><span class="dl">'</span></span>

gem <span class="s"><span class="dl">'</span><span class="k">rails</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">3.0.9</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">sqlite3</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">nifty-generators</span><span class="dl">'</span></span>
gem <span class="s"><span class="dl">'</span><span class="k">sunspot_rails</span><span class="dl">'</span></span>
gem 'sunspot_rails'

You could install pry on Rails by adding the pry-rails gem to your gem file:

group :development do
   gem 'pry'
   ...
 end

Once you have got that settled, change back into the sample_app directory and install all the necessary dependencies:

bundle install

Setting up the database:

rake db:schema:load

Note that some of you might need to prefix the above command with bundle exec.

One final thing before we proceed to the actual stuff: Create .pryrc in your home directory and fill it in with the editor of your choice:

% touch ~/.pryrc
Pry.config.editor = 'vim'

To launch pry through the terminal you simply write:

rails c

and you’re greeted with a pry console:

% rails c
Loading development environment (Rails 3.2.16)
Frame number: 0/3
[1] sample_app »

References

<references/>