Search Sorting Help Needed

My basic plan was to create a listing in the database as a data type.

I would also create “options” or “facilities” as a database data type.

The listing would have a data field of “options” or “facilities” as a list.

There would also be a data type of neighborhoods.

Each listing would have a single item data field of neighborhood or property type.

Essentially each listing would have some lists as data fields which correspond to data types ( ie: facilities ) as well as single item data fields that correspond to data types ( ie: property type or neighborhood ).

On the search page the user could select multiple single item data fields and display all results that have those single item data fields. ( ie: select hotel, hostel and condo and see all results for those three ).

As well the user could select multiple list item data fields and display all results that have those items in their list data field. ( ie: select bar, hiking, evening entertainment and see only results that have all three of those “facilities” in their list. )

Also the user could select to sort the results by price or review score etc.

I’d like them to be able to make these choices in any order and have the results update automatically displaying results that meet all the currently selected “options”. As the user selects more “options” the results update automatically and has they deselect “options” the results update automatically.

I’d like it to function just like booking.com or agoda.com

Below is a link to the app…I have it set to everyone can view. Just in case anybody wants to have a poke around a try to figure this issue out.

Cheers

Matt

This is a classic pattern - no checkboxes selected = ALL are selected (as you don’t want to filter).

You can either a) remove filters using a conditional based on the selections or b) set your states using a condition when there are no selections to ALL in the background.

I have updated the app so that the Property Type and Activity filters are working in this way.

So you combine all the filters in one.

Then have a “do when” condition that triggers when there are no selections.

So here the state is ALL the Facilities when none is selected.

Now all you need is a way to handle the case when the first selection is made, so that the state is set to just the one you selected and you lose the rest.

The “remove” workflow action remains the same, as removing the last checkmark will trigger the “do when” to set the state to ALL again.

Hopefully that makes sense !

1 Like

Thanks for the help.

One concern when reading this though is about the facilities. One property would have multiple facilities. So for example one property has a pool, a fitness room and a bar.

If the state is set to ALL the Facilities when none is selected, then that would mean for a property to be displayed the property would need to have all of the facilities in their list of facilities data field? So, the property with the pool, a fitness room and a bar would not be displayed as it only has 3 of the facilities out of the 200 possible?

I just had a look at the site. When doing a search and adding the Facilities, the opposite of what should happen is occurring. Instead of showing less properties as I add facilities, it is showing more properties.

What I’d like is if I select Hiking and Bikes Available for Free, then only properties that have both available will be displayed. What is happening now is that all properties that have any of the selected Facilities are displayed.

In this search only one property has Bikes Available.

In this search it should still only show one property because it would be the only one property with both Bikes and Hiking. However, it shows three properties that have either Bikes or Hiking.

Is there a quick fix to that?

Ah, I see !

So a quick fix is to add a condition in that case, so you remove the facilities filter when no facilities are selected.

But actually a smarter way to do it is to do away with “do when” condition and just do and advanced filter …

intersection of activities on the state with activities on the listing = count of state activities.

this still works when there are none selected, as the count of state activities = zero.

Not answering your specific question, but if you will be very interested in this thread and my conversations with @luke2 and the video that I did explaining a better approach to how one might handle “facilities”…

Thanks for the help. I will have a try with that and try to play around with the advanced filter. I haven’t gotten into that functionality before, so will see if I can’t figure it out.

Will update after the weekend how I get on with it and hopefully will be posting successful results.

Hey Keith

Thanks for the post. I actually had read that thread and watched your video a couple weeks ago and found it extremely helpful. Fully impressed with the immersive tutorial you put together on the topic.

After watching the video I was able to put together a pretty spiffy (not design but functionality) admin page for adding and removing amenities using auto binding and a custom radio button (couldn’t figure the installed radio button functionality).

It seems like you have done a listing site before. How did you get over the search results display hurdle?

Right now my struggle is that I have two basic types of data fields that I want my results to be filtered by. I have a data type of Listings. I have a data field of property type (each Listing will have only one property type) and another data field of amenities, which is a list (each Listing will have multiple amenities in it’s list).

Have you successfully put together a search results display that would allow a user to search in a variety of ways?

I was thinking about following Nigel’s idea from another post where he mentioned having an author’s name as a data type with a data field of book’s name, as well as a data type of book’s name with a data field of author’s name.

I’m thinking about attaching to the Facilities Data Type a data field as a list of Listings. Currently I only have a Data Type of Listings with a data field as a list of Facilities. I think this might give me more controls and options for how to search. Should be quick to implement as it would only be a couple of added events in the workflows on my admin pages.

@NigelG
Thank you thank you thank you.

I’ve got it working! I’m extremely excited. I’m now ready to start building out again and getting back to making progress.

What I ended up doing to get over the issue of the facilities is shown below.

As you said I did away with the “do when” statement; basically just disabled it to begin with have since deleted it.

Then in the filter on the search of the repeating group I did an advanced search.

This has been working well for these three data fields. I will be adding more soon and keeping my fingers crossed it keeps working as I add.

Thanks again. Very grateful for your help.

Cheers

Matt

1 Like