State vs State Region (how to setup?)

Hello, I’m stuck in trying to figure out how to make this happen with Algolia.

Need results:
People can search a State/ State-Region dropdown box.

This dropdown box has these options:

Texas
–South Texas
–North Texas
–East Texas
–Central Texas
–West Texas
Florida
–Panhandle
–North Florida
–South Florida

and so on… it has State Name (by itself) and then the regions of the state.

So “WHAT” should the search index look like?
2 fields or 1 field?
Do I need 2 indices or one?

I’m confused on how to solve this.
I’m somewhat sure I need 2 fields for my own data, as in this:
State
State-Region

BUT how to use Algolia search where search only has 1 field.

thanks!

Is it possible to do something like this:

  1. the single search dropdown box has all states and all sub-state regions.
  2. if search picks a state name (by itself), somehow tell Algolia to use the “state” field.
    if searcher picks an option that has state + region, then Algolia uses the “state-region” field.

I can hard code the 50 state names in Algolia, so some “filter”, etc. in Algolia knows to use the State OR state-region field?

THIS way, I only have 1 search dropdown box on the UI, but the index has 2 fields.

does that make sense? can Algolia work that way?

Hi,

This is actually very dependent on what and how you expect your users to search for, as well as the search experience your are looking for.

What is clear for now is that you need to have two types of records: state and state-region records. Now what we need to define is where they should live (same index, separate indices) and what attributes they should have.

The very first question that needs to be answered is whether this data is to be used as a filter for some other data or if it is the main content we are searching for. If it is to be used as filters, then the state and state-region data should probably be part of the data that we want actually to search for.

Assuming that this data is the main content we are searching for, a critical question that needs to be answered is “Should results for a state-region appear when a user types in a region?”. E.g. if a user types “Texas”, should the dropdown show just Texas, or should it also show state-regions like South Texas, East Texas, etc. ? You should also consider the opposite question: “Should state results appear when a user searches for a state-region”. For instance, suppose a user types in “Panhandle”, should the “Florida” record appear in the search results?

Answering these questions will help us define what must be present in your state and state-region records. If you want state-regions to appear when a user types in a state, that means that your state region records must include the state in their data. While if you want regions to appear when a user types in a state-region, like panhandle, then all the names of all the different state-regions need to be present in the state record.

Another question that needs to be tackled would be “How do I want to decompose my search results?”. There are multiple ways of presenting this state and state-region data, and some might provide results to your users in a way that they find clear while other designs might confuse them for certain queries. For instance, you could have the hierarchy that you described:

Texas

  • South Texas
  • North Texas

Florida

  • Panhandle
  • North Florida

Or you could decompose your search like this:
States

  • Texas
  • Florida

Regions

  • South Texas (Texas)
  • North Texas (Texas)
  • Panhandle (Florida)
  • North Florida (Florida)

The first decomposition introduces a nice visual hierarchy between states and regions, but will force you to have a very strange ranking which will probably have a negative impact on the relevance of your results. It also forces you to have region data in state records.

The second decomposition may look a bit more awkward on the first search, but will yield very clear results to the user. It will be evidently clear what kind of results they are looking at, and the ranking can be easily managed.

Let me know if that helped you clearly decompose your users needs!
Best,

Thanks Jonathan, appreciate the input and insight!
You got me on the right path