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 8910347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:40:03+00:00 2026-06-15T03:40:03+00:00

thank you for taking your time Problem I have a problem with searching records

  • 0

thank you for taking your time

Problem

I have a problem with searching records based on a fuzzy name search and an exact Regio search. This is what I have now:

What I have now

# :klantnaam is a param from a search-form
@param = Staffingcustomer.search do
    fulltext params[:klantnaam]
end
@staffingcustomers = @param.results

There is another field, ‘Regio’.
The results should only be with a certain ‘Regio’.

Example requirements

So for example,
I’m a user with Regio 3.
I want to visualize/select all Staffingcustomers with Fuzzy name search Anne and my own Regio 3. So, I don’t want to see Staffingcustomers with Regio 2.

What happens now is:

@param = Staffingcustomer.search do
     fulltext 'anne'
end
@staffingcustomers = @param.results

Will return all Staffingcustomers with all different Regios…

After some research / logic thinking

I think it could be something like the following:

@param = Staffingcustomer.search do
    fulltext params[:klantnaam]
end
@staffingcustomers = @param.results.find(:all, :conditions => {:regio => 3})

or

@param = Staffingcustomer.search do
    fulltext params[:klantnaam] and fulltext '3'   ## or 3, without the quotes
end
@staffingcustomers = @param.results

But that just doesn’t seem to work.

Can you help me with this issue?

The logic problem

Actually this is a fuzzy search on an ‘exact selected’ part of a huge table.

Hope you can help.

Thanks in advance.

Kers.

  • 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-06-15T03:40:06+00:00Added an answer on June 15, 2026 at 3:40 am

    I think you want something like:

    # find Staffing Customers with Regio 3 and text of params[:klantnaam]
    @param = Staffingcustomer.search do
      with(:regio, 3)
      fulltext params[:klantnaam]
    end
    @staffingcustomers = @param.results
    

    Refer to https://github.com/sunspot/sunspot#readme . You’ll also have to index regio in Searchable block of your Staffingcustomer model as whatever data type you stored in the DB (integer, for example).

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

Sidebar

Related Questions

thank you for taking your time in reading this. I hope it is not
thank you for taking the time and interest reading this and hopefully helping me
Thanks for taking the time to read this. I have an unknown number of
First off thank you in advance for taking time to help me with this,
First of all thanks for taking your time to help me with this. Sorry
first of all thanks for taking your time! I'm a junior Dev, working with
Thank you in advanced for taking the time to read my post. I will
First off, let me thank you if you're taking the time to look at
First of all thanks for taking the time to look into this. I store
I have been pondering about this for some time. How do you pick a

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.