# Can't get filter to work in 6.0

**URL:** <https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514>\
**Category:** Help\
**Created:** [April 24, 2025, 12:55pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514 "2025-04-24T12:55:09Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 24, 2025, 12:55pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/1 "2025-04-24T12:55:09Z")

</div>

V6.0 on win10 (I hate upgrades)  
On 5.2.4 I had a filter to find a marriage person event within 8 degrees of the home person. This worked however when saving new records it took 10 seconds to complete the task.

Now with 6.0.1 I can’t get it to work at all.  
I have created in desperation two filters. One to find the marriage event and another to find all people within 8 degrees of the home person. Both work as expected as stand alone filters, however when I combine them together, they produce no results.

Any ideas?

---

<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:** [April 24, 2025, 1:14pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/2 "2025-04-24T13:14:52Z")

</div>

Have you tried the Optimizer class patch by @kku ?

> [@Strange filter behavior in 6.0.1](https://gramps.discourse.group/t/strange-filter-behavior-in-6-0-1/7505/8):
>
> I investigated this a bit. It seems that there might be an issue with the new Optimizer class in Gramps 6.0. Not sure why but this workaround seems to help: add a line in the method apply\_logical\_op\_to\_all in the file gramps/gen/filters/\_genericfilter.py ([around line 149](https://github.com/gramps-project/gramps/blob/827b2018d01bb166ae3efe8bdfdb4f0070957605/gramps/gen/filters/_genericfilter.py#L147-L148)) as follows: optimizer = Optimizer(self) handles\_in, handles\_out = optimizer.get\_handles() if not handles\_in: handles\_in = None # add this line

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 24, 2025, 1:27pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/3 "2025-04-24T13:27:42Z")

</div>

Just saw that. Will try it this afternoon.

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 24, 2025, 5:42pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/4 "2025-04-24T17:42:25Z")

</div>

Tried adding the patch. No change. Nothing returned.

Here is my rule:

 ![Capture1](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/9/9570b8c04d3a18582c3c9fe169abe94807d16b22.jpeg)

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 24, 2025, 6:45pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/5 "2025-04-24T18:45:31Z")

</div>

Well I have really broken Gramps now. Can’t run any rules based on the People View. They run against other parts.  
I get the following error report

```python
71595: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gui\filters\sidebar\_sidebarfilter.py", line 166, in clicked
    self.clicked_func()
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\plugins\gramplet\filter.py", line 78, in __filter_clicked
    self.gui.view.build_tree()
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gui\views\listview.py", line 364, in build_tree
    self.model.rebuild_data()
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gui\views\treemodels\treebasemodel.py", line 520, in rebuild_data
    self._build_data(self.current_filter, None, skip)
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gui\views\treemodels\treebasemodel.py", line 589, in _rebuild_filter
    self.__rebuild_filter(
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gui\views\treemodels\treebasemodel.py", line 620, in __rebuild_filter
    for handle in dfilter.apply(
                  ^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 285, in apply
    res = self.apply_logical_op_to_all(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 189, in apply_logical_op_to_all
    if apply_logical_op(db, obj, self.flist) != self.invert:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 222, in and_test
    return all(rule.apply_to_one(db, data) for rule in flist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 222, in <genexpr>
    return all(rule.apply_to_one(db, data) for rule in flist)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\rules\_matchesfilterbase.py", line 103, in apply_to_one
    return filt.apply_to_one(db, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 244, in apply_to_one
    res = self.and_test(db, data, self.flist)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 222, in and_test
    return all(rule.apply_to_one(db, data) for rule in flist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.1\gramps\gen\filters\_genericfilter.py", line 222, in <genexpr>
    return all(rule.apply_to_one(db, data) for rule in flist)
               ^^^^^^^^^^^^^^^^^
AttributeError: 'IsActivePerson' object has no attribute 'apply_to_one'

```

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 24, 2025, 7:02pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/6 "2025-04-24T19:02:16Z")

</div>

Further info.

- checked DB - ok
- the one rule that fails is that I have tested with:  
People with events with the   
Role=“Unknown”;Inverse=“0”

Fails on the examplegramps DB too

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 25, 2025, 8:12pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/7 "2025-04-25T20:12:48Z")

</div>

Gave up on 6.0.1 and went back to 5.2.3

---

<div class="post-metadata">

**Author:** ![DaveSch](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesch/32/40_2.png) [@DaveSch](https://gramps.discourse.group/u/DaveSch)\
**Post date:** [April 25, 2025, 8:37pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/8 "2025-04-25T20:37:07Z")

</div>

@SteveY came up with a solution for my filter issues. It might work for you.

> [@Strange filter behavior in 6.0.1](https://gramps.discourse.group/t/strange-filter-behavior-in-6-0-1/7505/19):
>
> I’ve posted a potential fix for review [Fix Filter Optimizer Logical Op · Pull Request #2052](https://github.com/gramps-project/gramps/pull/2052)

Just remember to revert any changes you made to \_genericfilter.py in the last attempt at a fix.

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 25, 2025, 8:50pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/9 "2025-04-25T20:50:52Z")

</div>

Thanks, but I’ll wait until 6.0.2 comes out. I’ve waisted enough time and it doesn’t have anything I really need.

---

<div class="post-metadata">

**Author:** ![SteveY](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@SteveY](https://gramps.discourse.group/u/SteveY)\
**Post date:** [April 25, 2025, 9:00pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/10 "2025-04-25T21:00:32Z")

</div>

Unfortunately, this looks like a different problem.  
I might be able to extract enough from the error message to reproduce the problem

---

<div class="post-metadata">

**Author:** ![SteveY](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@SteveY](https://gramps.discourse.group/u/SteveY)\
**Post date:** [April 25, 2025, 9:56pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/11 "2025-04-25T21:56:53Z")

</div>

The ‘IsActivePerson’ rule is part of the FilterRules addon. That addon has not yet been correctly updated to support the filter enhancements that were made in gramps 6.0.

I say correctly, because the gramps\_target\_version in the addon was bumped to 6.0 3 months ago.

---

<div class="post-metadata">

**Author:** ![SteveY](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@SteveY](https://gramps.discourse.group/u/SteveY)\
**Post date:** [April 25, 2025, 10:28pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/12 "2025-04-25T22:28:16Z")

</div>

PR for the IsActivePerson rule:  
[Update FilterRules addon for Gramps 6.0 by stevenyoungs · Pull Request #715 · gramps-project/addons-source](https://github.com/gramps-project/addons-source/pull/715)

Note that there are other rules in this addon that also need adjusting to work with gramps 6.0.

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [April 25, 2025, 11:22pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/13 "2025-04-25T23:22:45Z")

</div>

Thanks for looking at this issue.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [May 25, 2025, 11:23pm UTC](https://gramps.discourse.group/t/cant-get-filter-to-work-in-6-0/7514/14 "2025-05-25T23:23:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
