Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to exclude fields from front-end search results. #2600

Closed
jsunsawyer opened this issue Mar 19, 2018 · 5 comments
Closed

Add option to exclude fields from front-end search results. #2600

jsunsawyer opened this issue Mar 19, 2018 · 5 comments
Labels
enhancement improvements to existing features system administration 💼 features related to system administration

Comments

@jsunsawyer
Copy link

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.

@brandonkelly brandonkelly added enhancement improvements to existing features system administration 💼 features related to system administration labels Mar 21, 2018
@Harry-Harrison
Copy link

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.

@brandonkelly
Copy link
Member

We’ve added this for Craft 3.1 :)

@jsunsawyer
Copy link
Author

jsunsawyer commented Jun 7, 2018

@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 added a commit that referenced this issue Sep 11, 2018
@hiasl
Copy link
Contributor

hiasl commented Feb 13, 2019

@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

@brandonkelly
Copy link
Member

brandonkelly commented Feb 13, 2019

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

{% set entries = craft.entries()
    .search('your search query')
    .id(['not', mainEntry.id])
    .all() %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to existing features system administration 💼 features related to system administration
Projects
None yet
Development

No branches or pull requests

4 participants