# How to filter by properties and nearText in v4?

**URL:** <https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535>\
**Category:** Support\
**Tags:** technical\
**Created:** [December 31, 2024, 3:56pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535 "2024-12-31T15:56:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeltaBoukensha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/deltaboukensha/32/1752_2.png) [@DeltaBoukensha](https://forum.weaviate.io/u/DeltaBoukensha)\
**Post date:** [December 31, 2024, 3:56pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/1 "2024-12-31T15:56:13Z")

</div>

Hi I am using the latest v4 weaviate client and wish to query a collection using nearText and filter by properties at the same time. How can I achieve this? Thanks

---

<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:** [January 2, 2025, 5:34pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/2 "2025-01-02T17:34:05Z")

</div>

hi @DeltaBoukensha !!

Welcome to our community 🤗

Check here how you can filter by properties:

> **[Filters | Weaviate](https://weaviate.io/developers/weaviate/search/filters)**
>
> Filters let you include, or exclude, particular objects from your result set based on provided conditions.

For instance:

```python
from weaviate.classes.query import Filter

jeopardy = client.collections.get("JeopardyQuestion")
response = jeopardy.query.fetch_objects(
    filters=Filter.by_property("round").equal("Double Jeopardy!"),
    limit=3
)

for o in response.objects:
    print(o.properties)

```

Let me know if this helps!

Thank!

---

<div class="post-metadata">

**Author:** ![DeltaBoukensha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/deltaboukensha/32/1752_2.png) [@DeltaBoukensha](https://forum.weaviate.io/u/DeltaBoukensha)\
**Post date:** [March 17, 2025, 5:41am UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/3 "2025-03-17T05:41:40Z")

</div>

Hi thanks for reply. How do I use filters in combination with nearText queries?

In your example you filter only by the property round.

If there would be another property called “description” how could I for example filter by description nearText “positive customer review” AND property round AND datetime perhaps?

---

<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 17, 2025, 2:30pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/4 "2025-03-17T14:30:43Z")

</div>

hi @DeltaBoukensha !!

You can filter with [multiple conditions](https://weaviate.io/developers/weaviate/search/filters#filter-with-multiple-conditions) and [nested filters](https://weaviate.io/developers/weaviate/search/filters#nested-filters).

For example:

```python
from weaviate.classes.query import Filter

filters = Filter.by_property("answer").like("*bird*") &
            (Filter.by_property("points").greater_than(700) | Filter.by_property("points").less_than(300))

jeopardy = client.collections.get("JeopardyQuestion")
response = jeopardy.query.fetch_objects(
    filters=filters,
    limit=3
)

for o in response.objects:
    print(o.properties)

```

Let me know if this helps!

Thanks!

---

<div class="post-metadata">

**Author:** ![DeltaBoukensha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/deltaboukensha/32/1752_2.png) [@DeltaBoukensha](https://forum.weaviate.io/u/DeltaBoukensha)\
**Post date:** [March 18, 2025, 1:16pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/5 "2025-03-18T13:16:57Z")

</div>

Like function seems to be a regexp. Is there a way to combine and use nearText search instead? Or otherways to combine vector search?

If it is not possible please just say so instead of suggesting alternatives. I would prefer you just confirm that it is not possible to use nearText search in combination with other filters.

---

<div class="post-metadata">

**Author:** ![DeltaBoukensha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/deltaboukensha/32/1752_2.png) [@DeltaBoukensha](https://forum.weaviate.io/u/DeltaBoukensha)\
**Post date:** [March 18, 2025, 1:36pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/6 "2025-03-18T13:36:58Z")

</div>

I tried this but I get a type error since I’m using typescript. Please help me, what could missing from the filters?

```auto
  const adventures = await client.collections.get("adventures").query.nearText(description, {
    filters: [
      client.collections.get("adventures").filter.byProperty('startDate').greaterThan(new Date()),
    ],
    targetVector: "vDescription",
    limit: 1000,
  });
  return adventures;

```

```auto
    No overload matches this call.
  Overload 1 of 3, '(query: string | string[], opts?: BaseNearTextOptions<undefined>): Promise<WeaviateReturn<undefined>>', gave the following error.
    Type 'FilterValue<Date>[]' is missing the following properties from type 'FilterValue': operator, value
  Overload 2 of 3, '(query: string | string[], opts: GroupByNearTextOptions<undefined>): Promise<GroupByReturn<undefined>>', gave the following error.
    Type 'FilterValue<Date>[]' is missing the following properties from type 'FilterValue': operator, value
  Overload 3 of 3, '(query: string | string[], opts?: NearTextOptions<undefined>): QueryReturn<undefined>', gave the following error.
    Type 'FilterValue<Date>[]' is missing the following properties from type 'FilterValue': operator, valuets(2769)
types.d.ts(61, 3): The expected type comes from property 'filters' which is declared here on type 'BaseNearTextOptions<undefined>'
types.d.ts(61, 3): The expected type comes from property 'filters' which is declared here on type 'GroupByNearTextOptions<undefined>'
types.d.ts(61, 3): The expected type comes from property 'filters' which is declared here on type 'NearTextOptions<undefined>'
(property) filters?: weaviate.FilterValue
The filters to be applied to the query. Use weaviate.filter.* to create filters

```

---

<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 18, 2025, 1:41pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/7 "2025-03-18T13:41:04Z")

</div>

Hi @DeltaBoukensha !

AFAIK, like will only support `*` and `?`

You can use the same filter with `near_text` or `hybrid` instead of `fetch_objects`

I see you are using JS, so it should be like this:

```ts
import weaviate, { Filters } from 'weaviate-client';

const jeopardy = client.collections.get('JeopardyQuestion');

const result = await jeopardy.query.nearText({
  filters: Filters.and(
    jeopardy.filter.byProperty('answer').like('*bird*'),

    Filters.or(
      jeopardy.filter.byProperty('points').greaterThan(700),
      jeopardy.filter.byProperty('points').lessThan(300)
    )
  ),
  limit: 3
})

```

Let me know if this helps.

---

<div class="post-metadata">

**Author:** ![DeltaBoukensha](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/deltaboukensha/32/1752_2.png) [@DeltaBoukensha](https://forum.weaviate.io/u/DeltaBoukensha)\
**Post date:** [March 18, 2025, 1:44pm UTC](https://forum.weaviate.io/t/how-to-filter-by-properties-and-neartext-in-v4/9535/8 "2025-03-18T13:44:27Z")

</div>

> [@DudaNogueira](#):
>
> `Filters`

Thank you so much. This helps ❤
