Filtering By Length issues

Hello, I am trying to use the filter by length but without success. First I have added the index to the class as follows:

'{"class": "BriefZ", "properties":[{"dataType":["string"], "name": "brief_id"}, {"dataType":["text"], "name":"brief_type"}, {"dataType":["text"], "name":"brief_name"}, {"dataType":["text"], "name":"brief_content"}], "vectorizer": "text2vec-openai", "invertedIndexConfig": {"indexPropertyLength": true}';

Now I am trying to query

{
  Get{
    BriefZ (
      limit: 3
      where: {
        operator: equal,
        valueInt: 0,
        path: [len("brief_content")]
      }
    ) {
      brief_name
      brief_type
    }
  }
}

but I get this error:

      "message": "Syntax Error GraphQL request (8:19) Unexpected (\n\n7:         valueInt: 0,\n8:         path: [len(\"brief_content\")]\n                     ^\n9:       }\n",
      "path": null

Been trying for over an hour and so need some help please

Hi @systemz,
Welcome to the community.

Can you try to update your where filter to :point_down:

      where: {
        operator: Equal,
        valueInt: 0,
        path: ["len(brief_content)"]
      }

There are two changes:

  • operator => Equal
  • path => "len(brief_content)"

Follow up

Thank you for sharing this with us.

We will take it as feedback for our docs and add missing examples for the filters :+1:

@sebawita this now works - thank u

      limit: 10
      where: {
          operator: NotEqual,
          valueInt: 0,
          path : "len(brief_content)"
      }
1 Like