Cms: Add option to exclude fields from front-end search results.

Created on 19 Mar 2018  路  5Comments  路  Source: craftcms/cms

We're using the Guest Entries plugin on a site and noticed that the email addresses that we're collecting are searchable on the front-end when using the standard search query.

We don't want people being able to glean info that should be private through searching.

Having a way to mark a field as unsearchable or an option to exclude that field in the search would be ideal here.

enhancement system administration

Most helpful comment

We鈥檝e added this for Craft 3.1 :)

All 5 comments

Could do with this for pretty much the exact same reason. We've got an "Editors notes" field that could contain potentially _sensitive_ information that shouldn't be search-able.

We鈥檝e added this for Craft 3.1 :)

@brandonkelly I'm having trouble finding a reference to this in the docs or 3.1 changelog. How does one go about implementing this?

Edit: I got over-eager. We're just past 3.0.10 haha. I thought we were an version 3.1 already! I'll keep waiting!

@brandonkelly can this feature be used with normal entries as well?

background: we have an entries field to select related content but I do not want the main entry to be found when the keyword appears in the selected related entries... thanks

if yes, please update the docs here: https://docs.craftcms.com/v3/searching.html#supported-syntaxes

@hiasl No but you could exclude the entry you don鈥檛 want using the id entry query param.

{% set entries = craft.entries()
    .search('your search query')
    .id(['not', mainEntry.id])
    .all() %}
Was this page helpful?
0 / 5 - 0 ratings