# How to use reference for filter effciently?

**URL:** <https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641>\
**Category:** Support\
**Created:** [March 7, 2024, 10:47am UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641 "2024-03-07T10:47:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadowlin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shadowlin/32/800_2.png) [@shadowlin](https://forum.weaviate.io/u/shadowlin)\
**Post date:** [March 7, 2024, 10:47am UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/1 "2024-03-07T10:47:01Z")

</div>

### Description

what does these warnning mean?

```auto
{"level":"warning","msg":"Number of found nested reference results exceeds configured QUERY_MAXIMUM_RESULTS. This may result in search performance degradation or even out of memory errors.","nested_reference_results":11922,"query_maximum_results":10000,"time":"2024-03-07T10:45:46Z"}

```

### Server Setup Information

- Weaviate Server Version: 1.24.1
- Deployment Method: docker
- Multi Node? Number of Running Nodes: 1
- Client Language and Version: python 4.5.1

### Any additional Information

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [March 7, 2024, 12:46pm UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/2 "2024-03-07T12:46:26Z")

</div>

Hi @shadowlin !

I believe that you have a cross reference that was requested on a query, and those references (of all the queried objects), are bringing more objects than what is set for QUERY\_MAXIMUM\_RESULTS.

here is the code where this warning comes from:

> <https://github.com/weaviate/weaviate/blob/5f86b6edcb5bfd8f20997d832ed3fa93726cb91f/adapters/repos/db/inverted/searcher_ref_filter.go#L75>

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![shadowlin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shadowlin/32/800_2.png) [@shadowlin](https://forum.weaviate.io/u/shadowlin)\
**Post date:** [March 7, 2024, 6:53pm UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/3 "2024-03-07T18:53:02Z")

</div>

I am using a schema like this:

File

- auth\_code

TextChunk

- text
- belong\_to\_file (reference to file)

is these a good idea that I have to use Filter.by\_ref("belong\_to\_file ").by\_property(“auth\_code”) to do filter?  
It could be a lot of qualified text chunks(could be 100k or millions ) after the filter.

---

<div class="post-metadata">

**Author:** ![Dirk](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dirk/32/46_2.png) [@Dirk](https://forum.weaviate.io/u/Dirk)\
**Post date:** [March 8, 2024, 12:57pm UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/4 "2024-03-08T12:57:52Z")

</div>

Hi @shadowlin!

> is these a good idea that I have to use Filter.by\_ref("belong\_to\_file ").by\_property(“auth\_code”) to do filter? It could be a lot of qualified text chunks(could be 100k or millions ) after the filter.

That could be very unperformant and memory intensive.

What are you trying to achieve? Maybe there is a more efficient way to do that

---

<div class="post-metadata">

**Author:** ![shadowlin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shadowlin/32/800_2.png) [@shadowlin](https://forum.weaviate.io/u/shadowlin)\
**Post date:** [March 11, 2024, 7:54am UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/5 "2024-03-11T07:54:49Z")

</div>

I want to filter text chunk by auth\_code and the auth\_code is on file level.  
I think another way is to let every text chunk has a auth\_code field but when update auth\_code I would have to update each text chunk for the file.

---

<div class="post-metadata">

**Author:** ![Dirk](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dirk/32/46_2.png) [@Dirk](https://forum.weaviate.io/u/Dirk)\
**Post date:** [March 14, 2024, 4:29am UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/7 "2024-03-14T04:29:07Z")

</div>

Is `auth_code`used to identify different customers on your side that shouldn’t be mixed? If yes, multi-tenancy might be a good alternative to filtering

---

<div class="post-metadata">

**Author:** ![shadowlin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shadowlin/32/800_2.png) [@shadowlin](https://forum.weaviate.io/u/shadowlin)\
**Post date:** [March 14, 2024, 1:24pm UTC](https://forum.weaviate.io/t/how-to-use-reference-for-filter-effciently/1641/8 "2024-03-14T13:24:25Z")

</div>

I do want to use multi-tenancy but the auth design need to mix them up some use have the permission to access almost all the file so can’t do that:\<
