Are the custom fields searchable in the user directory?

Thanks for this update!

Confirming that I understand with two questions-

  • is the user directory searchable by the custom columns as well; in this example- can i search by users’ answers to the “Favorite Color” profile field for instance?

  • does this also make “About Me” and “Website” default user fields searchable via directory?

3 Likes

The search is only for username, as far as I can tell. Maybe @HAWK can confirm this (that line was added after I posted)

4 Likes

I’ll add my desire to filter/search custom user fields in the user directory.

Our community runs a hybrid WordPress/Discourse setup and we’ve created a map-based member directory on the WordPress side. But what our members really want is an interest-based member directory.

This is really hard to pull off on the WordPress side. But I don’t think it would take too much work to implement at https://[YourDiscourseSite]/u.

For example, we have custom user fields for current learning goals, places you’ve lived, and – most popularly – interests/passions/skills. If I could do a keyword search for a shared interest of “community building” or even a learning goal of “python coding,” that would be incredible for my community.

@HAWK, I know you were nudged in @weallwegot’s reply in September 2022. I’m willing to spell out the specs for a feature request if that’s the way you want this desire to unfold.

For what it’s worth, I’m not the only one looking for enhanced search abilities in the user directory.

5 Likes

I almost forgot about this, as I had seen something related in release notes some time ago.

It looks like custom fields were made optional searchable in 2.7.0.beta8. (linked below)

Does this meet the requirements you have for your community?

5 Likes

Hi Joel :slight_smile:

No need to mention team members here, they read the forum, and if those in charge of a feature miss something, others will pass the info if they think it’s needed :slight_smile:

In this case, HAWK isn’t the person to mention anyway (see Sam Saffron and Sarah Hawk named Discourse Co-CEOs).

I tested the user directory search by custom field, and there is indeed room for improvement.

Among other things, special characters can make the search not return results when it should, the layout doesn’t have much room to show more columns, etc…
I think if changes have to be made, it would be starting from here, to have a cleaner and more reliable feature to work with.

I’ve made the team know about it! :v:

7 Likes

I’m glad you agree. :slight_smile:

I’m approaching it purely from a functional perspective. For example, can I do a keyword search in a custom field of interests for “community building” or even a learning goal of “python coding?”

Your eyes are probably more keen than mine for the UX.

I’d start with the functionality and then work on the UX. But that’s just me. Knowing Discourse devs, they can do both at the same time. :grinning:

I’m willing to have more conversation and even create some feature specs if that will help speed up any future development around searchable custom fields in the user directory.

4 Likes

Not sure where you were imagining the search happening, whether in the normal search page or separately on the user directory page.

If in the user directory, I was hoping for something like this:

Ideally I’d like it core to Discourse but if more people are interested, maybe we could create a plugin/theme to do it.

1 Like

Jim, I saw your forum thread as well when I was searching for a way to do what you and I both want to do. Having the functionality in Discourse core seems to make the most sense from my non-coding perspective because it seems like a useful tool for all Discourse users.

Having a plugin or theme component to do what we want will mean the vast majority of Discourse users never even know they have the option.

2 Likes

Ah yes, I agree, I’d prefer it be in Discourse core. I think the user directory can be one of the biggest features of Discourse, depending on how someone uses it. I imagine using it for a nonprofit association, where the communication could happen here, the member directory, and also the subscription if people want.

Perhaps it could start as a plugin/theme and then get integrated into core.

1 Like

Does this currently work with the core version of user field search? I took a look at the commit for that release and it looks like it should. I don’t have a handy instance now to test it - but curious specifically what you feel is missing!

I ask because I had made a plugin for this use case in 2020, but never got around to open-sourcing it. I’m really interested in exploring use cases for making content searchable in communities (especially across multiple platforms - so if this happens to be your use case let me know, would love to chat further!).

Anyways- here’s the plugin, i’m like 80% sure it’s redundant with how the core version ended up getting implemented, but in case there are improvements or collaborations in development- I thought I’d share.

3 Likes

No, what I describe doesn’t currently work as of Discourse 3.1.0.beta4.

Cool!

We actually use a WordPress-Discourse hybrid for our community. It would be amazing to be able to search across the two platforms with one tool, but I’d be happy with just searching for custom fields in Discourse.

You mentioned that you created it in 2020, so I wouldn’t have expected you to have updated it since then. :grinning:

I’m guessing there would need to be some further updates to the plugin before it was compatible with the current Discourse core version. And since I don’t believe the Discourse devs have any plans to incorporate custom fields searching in core, I’m just waiting for someone like you to say “My plugin works!” … and then I’ll test it. :slight_smile:

2 Likes

You can search by custom fields. :+1: You can make them searchable in the settings:

You can also include them as columns in the directory too (which means you could sort them by clicking on the column header):

And an example of a search:

You do need to wait for the Jobs::ReindexSearch background job to run [1] to include them, but you can speed that up by triggering it from your /sidekiq/scheduler page if you have access to it.


  1. which could take up to an hour ↩︎

4 Likes

This piece of knowledge was a huge missing piece for me! Previously, I just made certain custom fields searchable, added a column for their display at /u, and then searched right away. I didn’t get any results returned because the Jobs::ReindexSearch background job hadn’t run yet.

Now that I know this key piece of info, I was able to experiment with how I would use the custom fields search. Unfortunately, there are too many UX issues with the current functionality that would prevent me from allowing my forum members to use the custom field search.

I recorded this video to show Discourse devs, plugin developers, or anyone else who’s curious what I mean.

If you can’t or don’t watch the video, here are my written highlights of the UX issues.

  • The default option for the display is probably something other than All Time (e.g., Week or Month). So searchers might think that the search results they get are limited to people who have been active in the past X week / month / quarter / year.
  • The search box has text that says “filter by username.” Nothing about that says “Use me for a keyword search.”
  • The drop-down says “all groups” and people could be forgiven for thinking that the primary use of the search is group related and not forum-wide.
  • You can’t search by individual custom field. You’re searching all the fields at once and that might return too many results depending on your number of users and/or the keyword(s).
  • Typing in the search box returns real-time results as you continue to type. But the cursor has such a short stay time before new results are loaded and the cursor moves off the input field. Some people type slow or pause, so this isn’t great.
  • You have to scroll to the right for custom fields. And that’s not realistic on mobile view where most people are accessing the forum.
4 Likes

I’ve been yearning for a new interface for the directory, which I mentioned a bit here:

I wonder if a UI like that would be something you’d like as well.

I’ve also thought about how helpful the filters/search could be when combined with the User Map feature of the Locations plugin.

2 Likes