Search by Algolia
Easily integrate Algolia into native apps with FlutterFlow
engineering

Easily integrate Algolia into native apps with FlutterFlow

Algolia's advanced search capabilities pair seamlessly with iOS or Android Apps when using FlutterFlow. App development and search design ...

Chuck Meyer

Sr. Developer Relations Engineer

Algolia's search propels 1,000s of retailers to Black Friday success
e-commerce

Algolia's search propels 1,000s of retailers to Black Friday success

In the midst of the Black Friday shopping frenzy, Algolia soared to new heights, setting new records and delivering an ...

Bernadette Nixon

Chief Executive Officer and Board Member at Algolia

Generative AI’s impact on the ecommerce industry
ai

Generative AI’s impact on the ecommerce industry

When was your last online shopping trip, and how did it go? For consumers, it’s becoming arguably tougher to ...

Vincent Caruana

Senior Digital Marketing Manager, SEO

What’s the average ecommerce conversion rate and how does yours compare?
e-commerce

What’s the average ecommerce conversion rate and how does yours compare?

Have you put your blood, sweat, and tears into perfecting your online store, only to see your conversion rates stuck ...

Vincent Caruana

Senior Digital Marketing Manager, SEO

What are AI chatbots, how do they work, and how have they impacted ecommerce?
ai

What are AI chatbots, how do they work, and how have they impacted ecommerce?

“Hello, how can I help you today?”  This has to be the most tired, but nevertheless tried-and-true ...

Catherine Dee

Search and Discovery writer

Algolia named a leader in IDC MarketScape
algolia

Algolia named a leader in IDC MarketScape

We are proud to announce that Algolia was named a leader in the IDC Marketscape in the Worldwide General-Purpose ...

John Stewart

VP Corporate Marketing

Mastering the channel shift: How leading distributors provide excellent online buying experiences
e-commerce

Mastering the channel shift: How leading distributors provide excellent online buying experiences

Twice a year, B2B Online brings together America’s leading manufacturers and distributors to uncover learnings and industry trends. This ...

Jack Moberger

Director, Sales Enablement & B2B Practice Leader

Large language models (LLMs) vs generative AI: what’s the difference?
ai

Large language models (LLMs) vs generative AI: what’s the difference?

Generative AI and large language models (LLMs). These two cutting-edge AI technologies sound like totally different, incomparable things. One ...

Catherine Dee

Search and Discovery writer

What is generative AI and how does it work?
ai

What is generative AI and how does it work?

ChatGPT, Bing, Bard, YouChat, DALL-E, Jasper…chances are good you’re leveraging some version of generative artificial intelligence on ...

Catherine Dee

Search and Discovery writer

Feature Spotlight: Query Suggestions
product

Feature Spotlight: Query Suggestions

Your users are spoiled. They’re used to Google’s refined and convenient search interface, so they have high expectations ...

Jaden Baptista

Technical Writer

What does it take to build and train a large language model? An introduction
ai

What does it take to build and train a large language model? An introduction

Imagine if, as your final exam for a computer science class, you had to create a real-world large language ...

Vincent Caruana

Sr. SEO Web Digital Marketing Manager

The pros and cons of AI language models
ai

The pros and cons of AI language models

What do you think of the OpenAI ChatGPT app and AI language models? There’s lots going on: GPT-3 ...

Catherine Dee

Search and Discovery writer

How AI is transforming merchandising from reactive to proactive
e-commerce

How AI is transforming merchandising from reactive to proactive

In the fast-paced and dynamic realm of digital merchandising, being reactive to customer trends has been the norm. In ...

Lorna Rivera

Staff User Researcher

Top examples of some of the best large language models out there
ai

Top examples of some of the best large language models out there

You’re at a dinner party when the conversation takes a computer-science-y turn. Have you tried ChatGPT? What ...

Vincent Caruana

Sr. SEO Web Digital Marketing Manager

What are large language models?
ai

What are large language models?

It’s the era of Big Data, and super-sized language models are the latest stars. When it comes to ...

Catherine Dee

Search and Discovery writer

Mobile search done right: Common pitfalls and best practices
ux

Mobile search done right: Common pitfalls and best practices

Did you know that 86% of the global population uses a smartphone? The 7 billion devices connected to the Internet ...

Alexandre Collin

Staff SME Business & Optimization - UI/UX

Cloud Native meetup: Observability & Sustainability
engineering

Cloud Native meetup: Observability & Sustainability

The Cloud Native Foundation is known for being the organization behind Kubernetes and many other Cloud Native tools. To foster ...

Tim Carry

Algolia DocSearch is now free for all docs sites
product

Algolia DocSearch is now free for all docs sites

TL;DR Revamp your technical documentation search experience with DocSearch! Previously only available to open-source projects, we're excited ...

Shane Afsar

Senior Engineering Manager

Looking for something?

facebookfacebooklinkedinlinkedintwittertwittermailmail

Good news in the Algoliasphere: we just released a new major version of our Ruby Client. Did you know that the Ruby client was the very first we designed? Version 1.1.3 went out almost seven years ago! It did deserve some new fresh air, to say the least. This new version gets a brand new design and brings you tons of new features, along with being 100% compliant with Common API clients specifications. Let’s dig into this.

 

Algoliasearch becomes Algolia

The first thing you may notice is that we changed the name of our gem. Our Ruby Client now offers several distinct clients, for the different features of Algolia: Search of course, but also Analytics, Insights, and Recommendation. Because of this change, it only made sense for the gem to reflect the new architecture and to rename it simply “algolia”.

Using the full potential of our whole REST API is now a piece of cake, as you only have to instantiate your client of choice and use the endpoints we tailored for you. They all rely on our retry strategy to offer you the best possible experience (more on this later)

 

Modern tooling

We used the opportunity of the revamp to use state-of-the art-tooling in the Ruby community. Rake tasks handle the tests and linting. Linting is done with Rubocop, and testing with Minitest. We chose Minitest over Rspec for a simple reason: it was the only one providing the possibility of parallel testing. We wanted to make sure our client was compatible with JRuby so multi-threading is not looked over, and Minitest parallel testing assures us that everything is going smoothly. Also, all methods are documented using the Yard convention.

The minimum supported Ruby version is 2.2. It’s a version still widely used among our users, and it’s the least supported Ruby version in the previous version of Rails, v5. 

 

Fully independent Retry Strategy

To give you the best Algolis experience and offer you a robust client, we now implement the same Retry Strategy used in all our other clients. It’s the key element to ensure maximum service availability, and because it’s implemented as its separate class, it’s been thoroughly unit tested and works as a system on its own. It also means you can benefit from it in all our different client instances, and even in the event you decide not to use our bundled HTTP Client. Because yes, you’re free to use whatever HTTP client you prefer!

 

DIY client

This client is easily customizable. The most important things for us when we build our API clients are reliability and Developer eXperience (DX). We want you to be able to use our services with confidence, but also in the way you feel the most comfortable with. In that vein, you can override our requester, you can override our logger, and if you choose to stick with the requester we provide, Faraday, you can also override the adapter you’ll use with it. This is the reason why we chose Faraday as our default HTTP library. Not only was it a joy to implement, but it’s popular and frequently updated, and it answers that need for flexibility we aim to provide you. The default adapter we ship with it is Nett:Http:Persistent, but you can easily switch it for your favorite HTTP library (Excon, HTTPClient, or httpx to name a few). 

 

Request options

We simplified the way we handle optional parameters. Now, only mandatory parameters are expected in the method signature, and everything else can be passed in the last optional parameter as a hash. If you want to pass headers, timeout, connect_timeout or compression_type, you have to set them explicitly. The rest can be passed as is! It shortens the method signatures and also aligns with our others dynamically typed clients, like Python or PHP.  

 

Standalone configuration

We’ve added dedicated classes for configuration. This is where you can set timeouts, headers, and specific configuration for each client. Those configurations used to be set directly in the client, but now they have their dedicated class to make them easier to tweak, and separate the logic of each aspect of the clients where it belongs. For example, you can override the default hosts in the search config.

 

Search Client

The Search Client class has been cleaned up. In addition to handling the configuration separately, we also removed the Protocol class: now you can read the endpoints being hit directly in the main class, and get a better understanding of what’s going on under the hood. Most importantly, it is not a singleton instance anymore: you create your client by passing it your app ID and API key. This instance will run on its requester and pool of connections, and won’t interfere with any other instances running at the same time.

 

Search Index

The Search Index class remains mostly unchanged. As we mentioned before, the main improvement was to shorten the methods’ signatures by putting all the optional parameters in one single hash. As it was a really appreciated feature, we kept the bang methods to let you wait for the whole operation to finish. You can also do it the way we’re doing in the other clients, by chaining the `wait()` method after your call.

 

TL;DR

We got rid of the main pain points of the current Ruby client, the Singleton instance of the search client, and the fact that our Ruby Client was not aligned with our common specs. We now have a new base compliant with Algolia standards, with Ruby standards, and following the CTS with extra unit tests. We hope you’ll enjoy using this v2 as much as we enjoyed building it! If you want to get an exhaustive list of all the changes made, please refer to our Upgrade Guide.

Thank you for reading!

About the author
Chloé Liban

Software Egineer

githublinkedin

14-day free trial

Create a full-featured search experience in no time.

Get started
14-day free trial

Recommended Articles

Powered byAlgolia Algolia Recommend

How to build an API client for Javascript as a SaaS product
engineering

Peter Villani

Sr. Tech & Business Writer

Introducing our new navigation
product

Craig Williams

Director of Product Design & Research

Good API Documentation Is Not About Choosing the Right Tool
engineering

Maxime Locqueville

DX Engineering Manager