# A fluid.datasetfilter~ object for conditional querying

**URL:** <https://discourse.flucoma.org/t/a-fluid-datasetfilter-object-for-conditional-querying/598>\
**Category:** Toolbox 2 Improvement Ideas\
**Created:** [July 21, 2020, 9:52am UTC](https://discourse.flucoma.org/t/a-fluid-datasetfilter-object-for-conditional-querying/598 "2020-07-21T09:52:09Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)\
**Post date:** [September 18, 2020, 10:27am UTC](https://discourse.flucoma.org/t/a-fluid-datasetfilter-object-for-conditional-querying/598/16 "2020-09-18T10:27:47Z")

</div>

> [@rodrigo.constanzo](#):
>
> The main issue for this approach for me, at the moment, is that this process [is really slow](https://discourse.flucoma.org/t/biasing-a-query/506/5).

In that patch around half the time is taken up by the `dump` , so I guess it hinges on whether you really need that.

> [@rodrigo.constanzo](#):
>
> Actually, as a more specific sub-question. I take it this is a technical property of a kdtree, that once it is `fit` , it can’t be altered or filtered or anything, without recomputing a new `fit` ?

Yes. They trade off mutability for some simplicity, making them relatively simple to implement and good _enough_ for many purposes.

I wonder if there’s a way of reformulating what you want to do in terms of first querying a fixed all-in kdtree, and then filtering the results of that based on more flexible criteria? That would avoid re-fitting ( expensive, always will be), but also yields a smaller set to filter.

> [@rodrigo.constanzo](#):
>
> The interface for this starts getting messy if you have have queries that change a lot, and want to pass on specific columns/ranges accordingly.

That’s exactly where seeing some abstractions developed to cope with the mess is helpful. E.g., I could imagine storing protoype query messages in a coll

```

----------begin_max5_patcher----------
817.3ocuWFrbaBCDF9L9oPCSNR8fDXiSmldpuEMc7HCJIJCHQEhTmIS6ydkV
A1NMFC1QMW.qEP69s6peI+xrfvMxsrlPzmQeGED7xrf.vj0PP23fvJ517RZC
7Zg4xpJlPGF4dllsUC1UrbZYI5msLEm0f1PaXEHo.k+.UbOWbOJWJJ3ZtTzz
+skbAKW1JfIfzYTzVwEkLM3MbmwZpN+Ayjr13EsKZSWhmGGgv3UvsEw1aIIy
iQ+X+LIa08SUbmUdADtxMO9IRZn01umMydIZhI.A6WlO9M7eWYKuXdAUa.Wa
yBO+mvyDIBIwBQJYoiL.IBYPjR5r5Loetl4lmvMlTdXjMljTs8Gg6lgCwmbI
3CjbTxhGlrL.LxRWQZ20A3BODWGGCbezz2ZZeRuMtnfA3DeArNTu92X2YZcQ
0JoVZCucc8maEGecFTpOrGlDeV8vwWRQrh0zPum8FvHGE.xv.rf.wL1UYIWO
ewI6XOuJKdkWYCca3c7RMSgvnatAcENBQEEHB5KnqHleWTnLqaXnDT5s65ep
UrFSK.0JbsdbAqSjpRbBVoPsljrXjE2mYpZgGkxLLWyLYllAVnOtDVBNy1Ij
Q7Kj9TuVY7IC07b0FY44102QIYAHTmkMBkjAobHoYbhO2YRIqNAmiWMIqbbh
8a0j3yU23ysFll8+T4xqpxcpVwVgpNQKL5q2zqZkKKaqDnjoerpwasSVB2vY
Pk2JV4k7RlWK46EzGK0rWOep4AL95CUqS7ZquOWcaP7hWWiItCZlNRye5IEv
hNkPVen0PehUr1XxDDqoZshuwn+1zwaGvAgrpMrhCNpCrAbNuwr6q05RvHj3
5SefWgd9+4uw.bas+5bZirUk2G+tdxHzdvKXMZt.1t+f2wbTY3kNZYapNxdP
0Q8zqilJdQsjKzcnshXKTIoKcMk6G8NiLyAsFOxvdHEXNlxGjilheR7giHSw
So9vSoSu8484njofjOVQX1l7iocH4h7iSZgVW+DS0q.AtvHL+nTYGtJBFxEt
gflanh8zNEqEfEpxHAqMResJHrB2tLMz8oxBlRzxgudlENiKAQeA0rwWM0wA
r2vreO6uQASE3C
-----------end_max5_patcher-----------

```

One of Max’s greatest problems is that it tends towards mess very quickly, so any coping strategies are always interesting to see

---

_[View the full topic](https://discourse.flucoma.org/t/a-fluid-datasetfilter-object-for-conditional-querying/598)._
