# Collaborate on Optimizing a new Custom Rule

**URL:** <https://gramps.discourse.group/t/collaborate-on-optimizing-a-new-custom-rule/3063>\
**Category:** Development\
**Tags:** new\_filter\_rules, performance\
**Created:** [December 10, 2022, 5:59pm UTC](https://gramps.discourse.group/t/collaborate-on-optimizing-a-new-custom-rule/3063 "2022-12-10T17:59:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [December 10, 2022, 8:18pm UTC](https://gramps.discourse.group/t/collaborate-on-optimizing-a-new-custom-rule/3063/2 "2022-12-10T20:18:52Z")

</div>

- **Persons with events matching the \<event filter\>** : [GitHub code](https://github.com/gramps-project/gramps/blob/master/gramps/gen/filters/rules/person/_matcheseventfilter.py) • [wiki](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Filters#Places_enclosed_by_another_place)  
_Description:_ Matches persons who have events that match a certain event filter _based on_ MatchesEventFilterBase
- **Events of places matching the \<place filter\>** : [GitHub code](https://github.com/gramps-project/gramps/blob/master/gramps/gen/filters/rules/event/_matchesplacefilter.py) • [wiki](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Filters#Events_of_places_matching_the_.3Cplace_filter.3E)  
_Description:_ Matches events that occurred at places that match the specified place filter name _based on_ event.get\_place\_handle()
- **Places enclosed by another place** : [GitHub code](https://github.com/gramps-project/gramps/blob/master/gramps/gen/filters/rules/place/_isenclosedby.py) • [wiki](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Filters#Persons_with_events_matching_the_.3Cevent_filter.3E)  
_Description:_ Matches a place enclosed by a particular place _based on_ located\_in(db, place.handle, self.handle)

Dec 2023 - There is a simple, 2-rule, single-stage filter for this search. It looks in the Place [more precisely,the _Place **Title** _] for a String in both Personal and Family events.  
 (In the example.gramps tree, USA states are entered with the 2-letter abbreviation. The Place Title searching ignores Alternative names. So to avoid places like _ **Fl** orence, Italy_ in searches for _FL_ [**Fl** orida], you only have to include the Comma. Search the Place Title in the Places category to see what is the minimum string pattern is needed to disambiguate.)

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/8/8100f37623d77fb5aa41a8e0a8be4a8de2f42c52.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/e/e200133a41e8cd8f1cea1d89e6710256fe9b009b.png)

---

_[View the full topic](https://gramps.discourse.group/t/collaborate-on-optimizing-a-new-custom-rule/3063)._
