Exact word in a phrase ranking

Hi there!

If I do a search for the word “flu” I am getting the following results before “flu (Influenza)” and “bird flu.”

  • Fluid Restriction
  • Percutaneous Biopsy Under Ct- Fluro Guid
  • Fluids & Electrolytes
  • Fluoroscopy
  • Atrial Flutter

Is there anything I can do to make it so that I’ll get matches for the exact word in a phrase before getting a matching string in a word?

For example, I’d like to get results for “Bird Flu” before I get results for “Fluoroscopy”



Hi Angeline,

Thanks for reaching out with this question!

Firstly, I’m just wondering if you set up your searchable attributes yet? I ask this because by default the Algolia engine will make all attributes searchable. It’s a good idea to be explicit and tell Algolia which attributes should be searchable. This is because there are many attributes you might want indexed (such as image URLs) that don’t need to be searched.
Searchable attributes can be configured via the Algolia dashboard in the ranking tab.

Now for your ranking question, I did a few tests and I think for your case, to make “Bird Flu” rank higher than “Fluoroscopy” you can to set that attribute to UNORDERED. If an attribute is set to ORDERED that means that results were the matching word appears earlier in the attribute will rank higher. This is why “Fluoroscopy” was appearing before “Bird Flu”, because Flu is at the start of the attribute.

Let us know how it goes. If you have any other questions please let us know!


Hi Tony!

Thank you for helping me out! :slight_smile:

I set my attributes to UNORDERED and I got some different results. Maybe it’s because some of my attributes have large arrays with many words and “flu” is such a short word? I just want items with “flu” as one word in a phrase. We don’t think that “Percutaneous Biopsy Under Ct- Fluro Guid” matches “flu” as well as “flu (influenza)”

  • Arterial Interventions
  • Arteriovenous Malformation (AVM) Embolization
  • Avm Ablation
  • Biliary Intervention
  • Chemoembolization
  • Diagnostic Radiology
  • Enteric Feeding Tubes
  • General Interventional Radiology
  • Hemodialysis Access & Maintenance
  • Interventional Oncology
  • Interventional Radiology
  • Locoregional Therapy of Liver Tumors (Ablation, Chemoembolization, Radioembolization)
  • Minimally Invasive Treatment of Portal Hypertension (Tansjugular Intrahepatic Portosystemic Shunt (TIPS) Creation & Management)
  • Percutaneous Biopsy Under Ct- Fluro Guid

The result above will appear before:

  • ACE Inhibitors
  • ARBs
  • Chronic Kidney Disease Diet
  • Critical Care Nephrology
  • Dialysis
  • Fluid Restriction
  • Glomerular Filtration Rate
  • Hemodialysis
  • Home Dialysis
  • Home Dialysis Therapies
  • Nephrology
  • Non Tunneled/Tunneled Hemodialysis Catheters
  • Peritoneal Dialysis
  • Potassium-Restricted Diet

30 results later I will get “Flu (Influenza)”

  • Abuse and Violence
  • Accidental Amputation
  • Accidental Needle Stick
  • Acute Coronary Syndrome
  • Acute Respiratory Distress Syndrome
  • Airway Obstruction
  • Alcohol Abuse and Intoxication
  • Alcohol Dependence and Addiction
  • Alcohol Poisoning
  • Alcoholic Cardiomyopathy
  • Amphetamine Use Disorder
  • Anaphylactic Reaction
  • Angina
  • Angioedema
  • Ankylosing Spondylitis
  • Aortic Valve Regurgitation
  • Appendicitis
  • Arrhythmias
  • Aspiration Pneumonia
  • Asthma
  • Asthma Attack
  • Atrial Fibrillation
  • Avulsion Fracture
  • Back & Neck Pain
  • Bacterial Endocarditis
  • Benign Paroxysmal Positional Vertigo
  • Blood Clots
  • Bone Fractures
  • Bradycardia (Slow Heart Rate)
  • Broken Collarbone
  • Burns
  • Burns and Corrosions
  • Campylobacteriosis
  • Carbon Monoxide Poisoning
  • Cardiac Arrest
  • Cardiac Cachexia
  • Cardiomyopathy
  • Cellulitis
  • Chemical Burns
  • Chemical Poisoning
  • Chest Contusion
  • Chest Pain
  • Child Abuse and Neglect
  • Child Emotional Abuse
  • Child Maltreatment
  • Child Sexual Abuse
  • Chronic Low Back Pain
  • Closed Head Injury
  • Collapsed Lung
  • Concussion
  • Confusion
  • Coughing Blood
  • Crushing Injury
  • Deep Vein Thrombosis (DVT)
  • Dehydration
  • Diabetic Ketoacidosis
  • Diastolic Heart Failure
  • Dislocations
  • Domestic Abuse and Violence
  • Drug Abuse and Intoxication
  • Drug Allergy
  • E. Coli Infection
  • Elder Abuse and Neglect
  • Electrical Shock and Burns
  • Endocarditis
  • Exposure to Toxins (Toxicity)
  • Fast Heart Rate
  • First-Degree Burns
  • Flu (Influenza)

Thank you!


Hi Angeline,

Thank you for your detailed response! In order to get a better understanding of your results, would you be able to grant us access to your dashboard? You can modify access settings here: https://www.algolia.com/users/access_control
Keep in mind your data remains safe and no one outside of Algolia will be able to access it. You can revoke access anytime.


Hi Tobi!

I granted you Read access.

Let me know if you need higher permissions.

Thank you!

Hi Angeline,

Thank you for letting me take a look at your info!

Looking at your ranking formula, I noticed you have a number of SORT-BY attributes, and this has a direct impact on the textual tie breaking. The SORT-BY attributes are considered more of a “hard sort”, textual relevancy is going to be decreased in favour of a specific ranking strategy.
I would recommend changing these to CUSTOM RANKING attributes. By using custom ranking you will be filtering results based on textual relevance first, followed by your custom metrics.

Please let us know if this helps!


Hi Tobi!

Hi changed the attributes to CUSTOM RANKING like you suggested.

I’m still getting results like

  • Percutaneous Biopsy Under Ct- Fluro Guid
  • Cerebrospinal Fluid (CSF) Leak from Nose
  • Fluid Restriction

Before items like

  • Bird flu
  • Flu (Influenza)
  • Gastroenteritis (Stomach Flu)

If I add a space to my query "flu " Then I can get the results that I’m looking for.


I’m also getting unexpected results when I’m doing a search for “wood”

  • Stacy Woodburn
  • Bill Wooden
  • Terry Woods

I would like to be able to do a search for “wood” (without quotes) and get the following results:

  • Scot Wood
  • Ashly Wood
  • Jimmy Wood

These three results seem more relevent than the other three.