weaviate / weaviate/weaviate-python-client

Potentially incorrect parameter name for `min_occurrences `

Open
#1,269 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
227
Forks
151
Avg merge
3d 14h
Merged PRs (30d)
11

Description

The GQL syntax takes a limit param - and we've called the resulting parameter a min_occurrences in the Metric class. But in reality it seems to be a resulting object limit, as used in query.

Example use:

for c in [1, 5]:
    response = chats.aggregate.over_all(
        return_metrics=Metrics("company_author").text(
            top_occurrences_count=True,
            top_occurrences_value=True,
            min_occurrences=c,
        ),
    )

    print(response.properties["company_author"])

Response:

AggregateText(count=None, top_occurrences=[TopOccurrence(count=26351, value='AmazonHelp')])

AggregateText(count=None, top_occurrences=[TopOccurrence(count=26351, value='AmazonHelp'), TopOccurrence(count=15397, value='AppleSupport'), TopOccurrence(count=10876, value='Uber_Support'), TopOccurrence(count=6686, value='Delta'), TopOccurrence(count=6477, value='AmericanAir')])

If this is correct, maybe we could overload the Metrics.text class to take a limit parameter.
And maybe if someone uses min_occurrences it could be shown as deprecated?

If confirmed, the docs also need to be edited accordingly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the GQL limit parameter with the Metrics.text API and its min_occurrences behavior, then review the related documentation. Confirm whether the parameter limits returned objects, decide how the existing name should be handled, and update the API and docs consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, documentation
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.