# Are the custom fields searchable in the user directory?

**URL:** https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331
**Category:** Support
**Tags:** user-directory, user-custom-fields
**Created:** [September 8, 2022, 4:07pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331 "2022-09-08T16:07:01Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![weallwegot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weallwegot/32/124753_2.png) [@weallwegot](https://meta.discourse.org/u/weallwegot)
#### Post date: [September 8, 2022, 4:07pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/1 "2022-09-08T16:07:01Z")

</div>

> [@New Leaderboard/User Directory Features tada](https://meta.discourse.org/t/new-leaderboard-user-directory-features/195263/1):
>
> This means you can now create searchable user directories.

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?

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [September 8, 2022, 4:11pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/2 "2022-09-08T16:11:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### Post date: [February 17, 2023, 9:14pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/3 "2023-02-17T21:14:25Z")

</div>

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.

> [@Searching custom profile fields and profiles](https://meta.discourse.org/t/searching-custom-profile-fields-and-profiles/203625):
>
> I was searching and saw previous topics about custom profile fields and searching profiles. But going to the search page or users page doesn’t give options to make it easier to search those. About how much would it cost to create a plugin that allows the search feature to act as a directory where you can filter in certain sections? I know the search handles putting in what you searching for a user custom profile field but the results come up only on the small side and nothing to really separate…

---

<div class="post-metadata">

### Author: ![weallwegot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weallwegot/32/124753_2.png) [@weallwegot](https://meta.discourse.org/u/weallwegot)
#### Post date: [February 18, 2023, 12:00am UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/4 "2023-02-18T00:00:56Z")

</div>

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?

> [@2.7.0.beta8: Share Topic Modal Improvements, Searchable User Fields, Pause Animated Images, and more](https://meta.discourse.org/t/2-7-0-beta8-share-topic-modal-improvements-searchable-user-fields-pause-animated-images-and-more/188564#searchable-user-fields-3):
>
> New features in 2.7.0.beta8warning Rebuild required. The rebuild will update package versions to latest, and must be completed if the site has not be been rebuilt from the command line in the last few days. Share topic modal improvements The Share Topic modal has been overhauled. Topic invites have been updated to take advantage of the updated user invites system. “Inviting” an existing user has been renamed to “Notify”. Searchable user fields Staff can now configure user fields…

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 20, 2023, 4:09pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/5 "2023-02-20T16:09:25Z")

</div>

Hi Joel 🙂

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 🙂

In this case, HAWK isn’t the person to mention anyway (see [Sam Saffron and Sarah Hawk named Discourse Co-CEOs](https://meta.discourse.org/t/sam-saffron-and-sarah-hawk-named-discourse-co-ceos/253588)).

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! ✌

---

<div class="post-metadata">

### Author: ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### Post date: [February 28, 2023, 9:20pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/6 "2023-02-28T21:20:31Z")

</div>

> [@Canapin](#):
>
> I tested the user directory search by custom field, and there is indeed room for improvement.

I’m glad you agree. 🙂

> [@Canapin](#):
>
> 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’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.

> [@Canapin](#):
>
> I think if changes have to be made, it would be starting from here …

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. 😀

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.

---

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [March 2, 2023, 4:30am UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/7 "2023-03-02T04:30:18Z")

</div>

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:

> [@Searching custom profile fields and profiles](https://meta.discourse.org/t/searching-custom-profile-fields-and-profiles/203625/2):
>
> Yes, I’m yearning for something like this. I looked into the code a bit but couldn’t figure out how to do it with a theme component and if it requires much deeper coding (aka digging into Ruby), I currently have no idea how to do that smiley What I’m hoping to see is actually similar to what Circle just enabled for its platform. Here are two screenshots: I really like the simple dropdowns and ways to filter the …

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

---

<div class="post-metadata">

### Author: ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### Post date: [March 2, 2023, 2:04pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/8 "2023-03-02T14:04:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [March 3, 2023, 6:54pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/9 "2023-03-03T18:54:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![weallwegot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weallwegot/32/124753_2.png) [@weallwegot](https://meta.discourse.org/u/weallwegot)
#### Post date: [April 10, 2023, 11:03pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/10 "2023-04-10T23:03:37Z")

</div>

> [@JoelZaslofsky](#):
>
> 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?”

Does this currently work with the core version of user field search? I took a look at the [commit for that release](https://github.com/discourse/discourse/commit/e29605b79f25afac2d506c6371e1b528f120b670) 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.

[https://github.com/surf-search/discourse-searchable-user-custom-fields](https://github.com/surf-search/discourse-searchable-user-custom-fields)

---

<div class="post-metadata">

### Author: ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### Post date: [May 18, 2023, 4:52pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/11 "2023-05-18T16:52:31Z")

</div>

> [@weallwegot](#):
>
> > [@JoelZaslofsky](#):
> >
> > 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?”
> 
> Does this currently work with the core version of user field search? I took a look at the [commit for that release](https://github.com/discourse/discourse/commit/e29605b79f25afac2d506c6371e1b528f120b670) and it looks like it should.

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

> [@weallwegot](#):
>
> I ask because I had made a plugin for this use case in 2020, but never got around to open-sourcing it.

Cool!

> [@weallwegot](#):
>
> 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!).

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.

> [@weallwegot](#):
>
> 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.

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

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. 🙂

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 18, 2023, 5:12pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/12 "2023-05-18T17:12:22Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/2/3/423270b45bc1af57f6380d9fc2283fb055e511f0.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/f/2/9f21930f8cee73710ced368c8e35869bf87ca051.png)

And an example of a search:

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/5/0/450586440597f4cc06bea33e0f03661ecb6c39e5.png)

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

---

<div class="post-metadata">

### Author: ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### Post date: [May 19, 2023, 2:11pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/13 "2023-05-19T14:11:18Z")

</div>

> [@JammyDodger](#):
>
> You do need to wait for the `Jobs::ReindexSearch` background job to run to include [the custom fields as searchable], but you can speed that up by triggering it from your `/sidekiq/scheduler` page if you have access to it.

_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.

https://www.loom.com/embed/1485e76ff4cd485e970c97ce5db45976

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.

---

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [May 19, 2023, 5:30pm UTC](https://meta.discourse.org/t/are-the-custom-fields-searchable-in-the-user-directory/246331/14 "2023-05-19T17:30:22Z")

</div>

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

> [@Searching custom profile fields and profiles](https://meta.discourse.org/t/searching-custom-profile-fields-and-profiles/203625/2):
>
> Yes, I’m yearning for something like this. I looked into the code a bit but couldn’t figure out how to do it with a theme component and if it requires much deeper coding (aka digging into Ruby), I currently have no idea how to do that smiley What I’m hoping to see is actually similar to what Circle just enabled for its platform. Here are two screenshots: I really like the simple dropdowns and ways to filter the …

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.
