Adding Search feature in Rails 3 application - ruby-on-rails-3

I have developed a database backed application in Rails 3 www.pajamadeals.in . Now, I intend to include search feature in it. Where people can search books, instruments, etc. How do I implement search feature. Any gem or plugin recommendation? Should I roll my own code for search capability?

There are couple of gem is usefull for full text searching
1) You can use thinking-sphinix,for quick start up you can refer http://railscasts.com/episodes/120-thinking-sphinx,
2) You can use solr you can refer http://railscasts.com/episodes/278-search-with-sunspot
3) Elastic Search
Sphinix is a good solution fr easy start.

Related

Implementing Sitecore Search Using Lucene

I am in the process of trying to get Lucene search to work with my Sitecore installation.
I have tried following the example listed in the Sitecore guide (sections 2.1 thru 2.2.2).
After adding the LuceneSearchBox and clicking on the control's search button, I receive the following error:
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
This is what appears in the address bar, in the event it provides some helpful clues:
mytestsite/sitecore/service/nolayout.aspx?item=%2fstandard_items%2fsearch_results&layout=%7b00000000-0000-0000-0000-000000000000%7d&device=Default
Should I be doing something with the LuceneSearchResults control? The guide does not mention doing anything with the LucenSearchResult control.
Notes:
I am using this on a web site that I have created, not the "Office Core Web site" listed in the guide.
I am running Sitecore 6.3.1
The most common way of working with Lucene in Sitecore is by using the Advanced Database Crawler project. Alex Shyba, a Solution Architect at Sitecore, put together a C# class library that wraps the native Lucene functionality and adds helper methods to make it easy to use Lucene to search for content in Sitecore.
There's two parts to this project: 1. Advanced Database Crawler, 2. Searcher.
Here's the URL, http://sitecoreblog.alexshyba.com/2010/11/sitecore-searcher-and-advanced-database.html?m=1.

How can I implement reddit style sub instances of my website?

I have a website that I made using ruby on rails at www.tradespring.net. I want to create a bunch of instances, like www.tradespring.net/electronics, www.tradespring.net/automotive, ect. where these sub-sites work exactly the same as the original but each have their own set of posts, but users are the same across all sub-instances.
Where could I start looking? I don't even know good keywords to google at the moment.
You can start with two best webcasts created by Ryan lately which explains creating multitenancy application in Rails.
Multitenancy with Scopes
Webcast: http://railscasts.com/episodes/388-multitenancy-with-scopes
Source Code: https://github.com/railscasts/388-multitenancy-with-scopes
Multitenancy with PostgreSQL
Webcast: http://railscasts.com/episodes/389-multitenancy-with-postgresql
Source Code: https://github.com/railscasts/389-multitenancy-with-postgresql
[update] Oh! I missed that these are pro webcasts. Though you can check source code of these webcasts.

Rails 3 - exist any gem for counting page views?

I wanna to add to my blog a counter for displaying, how many times was an article displayed. I would like to solve it through ruby (not GA or something like that).
Is available any gem that do this task (also with checking IP address and the time of latest reading of article) or I have to implement by myself?
There's one used by thousands of people at http://www.seologic.com/webmaster-tools/counters. Source code is available at https://github.com/ivanoblomov/hit_counter.

How to create user specific content, that is invisible to others?

I am absolutely new to Ruby on Rails, even to programming at all. I got started with Michael Hartl's Rails Tutorial using Rails 3.0.10. Now I alter its aim towards creating an application that allows users to manage their own "projects". These projects are to be exclusively available to the logged-in user, thus, invisible to others.
My problem is: I am unable to create a page with an URL like "~/users/1/projects", I don't know about the routing. All i get done is "~/projects", which is fairly not what i want at all. So, how do I get this problem fixed? Or am I totally off track with that idea?
I generated a Projects model by scaffolding. So, how can I implement it for the signed-in users?
this would be done by creating a nested resource. when you are new to rails and programming you should work yourself a way through a lot of tutorials and guides.
a good place to get an overview are the official rails guides. in this specific case the chapter about routing: http://guides.rubyonrails.org/routing.html#nested-resources
# config/routes.rb
resources :users do
resources :projects
end

Rails 3 CMS + blog wanted to fit existing site. Unobtrusive and Lightweight

I'd like to add a CMS and blog to a web app. One that won't get in the way. There's not a lot of content, but enough that we want non-devs to be able to revise pages and probably add and remove them too.
We have a substantial app that can't be touched by the CMS, not a site that we're migrating.
How have you dealt with this situation?
Would you advise:
Running two apps (a content app and the 'app' app)
Plugging in a light weight CMS
Rolling our own using gems/plugins for WYSIWYG
Details
We'll be adding a bug ticketing and support system later too. Probably built into the app.
We'd like the users of the app to be able to comment on pages and blog posts, file tickets, etc. all from their main account, so it seems to make sense to build it into our app, rather than as an extra app. Love to hear war stories on this.
Should be:
Unobtrusive (Shouldn't interfere with the existing app)
Must not mess with Devise, DeclarativeAuthorization, or Omniauth. We've got extensive user accounts, permissions, authentication mechanisms and groups setup. These must stay.
Lightweight (prefer something dev friendly than feature loaded)
Desired Features:
Basic WYSIWYG for content editors
Lets us handle accounts (with Devise)
and maybe even permissions (with DeclarativeAuthorization)
I've read this similar question, but the author seems willing to have something a bit more intrusive.
Simple Rails 3 CMS Gem/Plugin?
Options Found
Refinery seems to have a lot of features, but at a cursory look it needs a lot of control over what's going on: http://refinerycms.com/guides/attaching-refinery-cms-to-an-existing-rails-application It says it's modular, but it seems like there's a big chunk of non optional stuff in there.
Radiant seems a bit monolithic as well
http://groups.google.com/group/radiantcms/browse_thread/thread/b691cf9ab644a8b2
ComfortableMexicanSofa seems a bit closer to what I want: https://github.com/twg/comfortable-mexican-sofa
Adva-Cms has the right philosophy but appears to be dead. Adva-Cms2 isn't ready
http://adva-cms.org/
Governor seems good, but maybe a bit too young and lean
https://github.com/carpeliam/governor
Conclusion
So far rolling our own, or using ComfortableMexicanSofa seems like the bet, but I'd like your thoughts before I spend a few days messing around with it.
I am now rolling my own blog app and I am kind of newbie to Rails 3. Even like that, in 1 week i have a blog with tags, comments, authentication with omniauth, etc.. my advise is: roll your own. I was having the same doubt and looking for pre-made solutions and I decided to start it from zero and just look for plugins for anything i need.
It goes pretty fast if you know already some rails programming and you use the right plugins. This is what i used:
Omniauth to let users be able to autenticate with facebook, twitter etc.. and leave you comments.
rails_admin: it allows you to manage your blog by going to yourapp.com/admin. It uses devise to create an Admin user (you can specify a diferent model name than user to not to mix it with the users from omniauth or from your other app) and if you have the right models and associations between them you can from there create your posts, assign them tags or categories and also delete comments etc.. its all done in an easy way. For the Text Area that you use to introduce the content of your posts you can associate it with the ckeditor just by adding to the rails_admin initializer something like:
config.model Post do
edit do
field :body, :text do
ckeditor true
end
end
end
And with the ckeditor you can introduce pictures, attach videos, format text, and so on.
Use kaminari for pagination, or you can use will_paginate if you are more used to that.
Using the blueprint framework for styling with css you will save time and have a more standar styling.
Use few jquery lines to insert/delete comments graciously.
And that's all I can remember now. And if it shouldn't interfere with the main app, i would just assign a subdomain for it. So if you go to blog.myapp.com you access to the blog and if you go to myapp.com you access to the app. And you want users from the app to interact with the blog so you should use just one app and have this 2 subdomains pointing at differents parts of the same a app.. take a look at: rails 3 - one app, multiple domains, how implement a different 'root' route for one of the domains?
That's all i can think now! let me know if i can help you in anything else.
rails_admin: it allows you to manage your blog by going to yourapp.com/admin. It uses devise to create an Admin user (you can specify a diferent model name than user to not to mix it with the users from omniauth or from your other app) and if you have the right models and associations between them you can from there create your posts, assign them tags or categories and also delete comments etc.. its all done in an easy way. For the Text Area that you use to introduce the content of your posts you can associate it with the ckeditor just by adding to the rails_admin initializer something like:
config.model Post do
edit do
field :body, :text do
ckeditor true
end
end
end