Skip to main content

Thinking Sphinx on Ruby on Rails Application with Spree.

 

one of the easiest ways to connect your rails app with sphinx.
It is used to connect your Active Record with Sphinx search and it is easy to use and fast to install.

Install Sphinx: Add this to Gemfile.gem 
'mysql2', '~> 0.5.2'
gem 'thinking-sphinx'

Run bundle command:bundle install

For passing the indexing parameter, create ‘app/indices/modelname_index.rb’
Let’s do this with Spree Search. Here we are taking the example of the Product Model of Spree, Follow these steps:

  1. Create an index file in ‘app/indices/product_index.rb, add the indexing parameters.

`thinkingSphinx::Index.define 'spree/product', :with => :real_time do
indexes name, :sortable => true
end

2.  Run the command to index and start the Sphinx:

rake ts:stop
rake ts:index
rake ts:start
rake ts:rebuild (stops, re-index, and start)

3. Let’s search for Productspay-as-you-go with Sphinx:

# To query a product model
q = 'Search Product Name'
products = Spree::Product.search(q)


For more reference:
https://freelancing-gods.com/thinking-sphinx/v5/indexing.html

Conclusion
This is one of the easiest ways to enhance the Sphinx with Spree E-commerce service. By using this, it will boost the speed of your searching and the server response time of the application.

Comments

Popular posts from this blog

Top 7 Custom Software Development Companies in Florida, USA

According to the reports the custom software development market gets an estimated value of over US $390 in 2020. It is estimated to get a stack enhancement of 11% annually till 2028. Nowadays Organization software is adopted by almost every industry. When you execute a business, you need to know everything about web development companies , it boosts your sales. It includes the process, workflow management, and overall productivity. Transform your plans into consumer-friendly solutions to get an organizational product. Information technology gives a great impact on every industry. It impacts almost every sector of society as it considers an essential element of custom software development. This term can easily be specified as follows different steps and procedures that are mandatory for custom software development applications. However, this term is not as simple as people think. For an official term, the entire process is also called the software development process. When it is to th

ROR How Does Ruby On Rails Application Development Services Work For Organizations?

Our ROR developers are real IT experts who can write, design, develop and implement new software for the Ruby on Rails framework. But what exactly do our developers do? Let's see with the help of our blog. The Ruby on Rails developer pool is highly functional, making it difficult for recruiters or HR experts to find a suitable candidate for their team. The best Ruby on Rails developers will have excellent technical knowledge and fit into the company's culture and communication style. Use our Ruby on rails expert checklist to identify your company's needs and find the ideal candidate. We'll review what every recruiter or HR professional should know, including RoR developer traits. RUBY ON RAILS DEVELOPER RESPONSIBILITIES To write, design, develop and implement new software and application in Ruby. Design and development of new web applications Upkeep and troubleshooting of existing web applications. Write and maintain trustworthy Ruby code. Bringing data storage soluti

Single Page Applications: When and Why You Should Use

Everyone uses Facebook, Netflix, Gmail, Google Maps, and twitter in their day to day routine. Did you ever notice that these applications are developed under Single page applications architecture? Yes, these applications (Single page application or SPA) works on only one page. Such applications keep loading new data from a browser itself when a user hits a new request rather than loading a new page from a web server. Therefore, it doesn't take much time to load the data in front of the user. There are several reasons when and why a Single page application should be used. Architecture of Single page applications : Generally, in traditional application structure while retrieving the user's request it takes a round trip from browser to web server however in single page application, request is managed through web browser itself. The only difference came into the picture when data flowed from source to destination unless you are doing a partial rendering on the ser