Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:38:02+00:00 2026-05-30T11:38:02+00:00

I have been working on rails project, which had been made using noSql(Mongoid). Every

  • 0

I have been working on rails project, which had been made using noSql(Mongoid). Every thing is running fine.The issue is I want to add.. full text search here also. I had been using this gems for this…

gem 'mongoid_fulltext'

and my model file looks like this..

class Keyword
  include Mongoid::Document
  include Mongoid::FullTextSearch
  field :name, type:String
  #index :name, unique: true
  embeds_many :posts

  validates_presence_of :name
  validates_uniqueness_of :name

  fulltext_search_in :name, :index_name => 'name_index'
end

and in controller.

@keywords = Keyword.fulltext_search(params[:search], :index => 'name_index')

and then @keywords always returns an empty array always.

Thanks
Awieet

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:38:03+00:00Added an answer on May 30, 2026 at 11:38 am

    Apart from what I’m assuming are formatting errors, the only mistake I can find is that you seem to be naming the index manually.

    Maybe in your fulltext_search call you should use :index_name => 'name_index' instead of :index => 'name_index'.

    I’d advise just not messing with the default name of the index though, and removing that argument entirely from the method call.

    Also, were the records persisted before you added the mongoid_fulltext gem? If so you’ll need to call the update_ngram_index method on the Class object (or each instance) to add them to the index.

    Other than that, have you checked out the mongoid_search gem as an alternative to mongoid_fulltext?

    https://github.com/mauriciozaffari/mongoid_search

    I’ve tried both and find find that this one has a much cleaner implementation and interface. Then again, I only use fulltext search sparingly. You may be using fulltext search more than I, and I’m not sure what the differences are feature-wise, but worth a look.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just been informed that a Rails 3 project I've been working on
I've been using Rails 2.3.8 for a project that I've been working on, but
On a rails project that I know to have been working as recently as
I have been working with rails 2.3.5. I am gonna start a new project
I have been working on a web services related project for about the last
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been working with Struts for some time, but for a project I
I have been working on a Rails template recently called BaseApp2. You can see
I have been working on implementing the Ancestry gem in my rails app, I
I have been working with Ruby on Rails for over a year now and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.