"refresh" an enumProperty

here is part of my register function:

def register():
    from bpy.types import WindowManager
    from bpy.props import StringProperty, EnumProperty
    wm = WindowManager

    wm.selected_material = EnumProperty(items = enum_previews_from_directory_items)

I have a text box that I want the user to use if they want to search for an item in that list. How do I “reload” or “refresh” the EnumProperty to update the items?


is there an easy way to exclude items from there that don’t match the search?