Skip to content

SEARCH-758: Include repeated counts in release and area totals - #183

Open
amCap1712 wants to merge 1 commit into
masterfrom
distinct-count-issue
Open

amCap1712 wants to merge 1 commit into
masterfrom
distinct-count-issue

Conversation

@amCap1712

Copy link
Copy Markdown
Member

Search fields discarded duplicates before summing. A release with two three-track mediums was indexed with a total of three tracks, so a search for six tracks missed it.

Keep repeated values when summing release tracks and area references. Other fields still deduplicate values in the order they are read. Convert UUIDs to strings during collection so artist ID fields can use the same logic.

Cover both deduplication modes and verify that a release with two three-track mediums is indexed with six tracks.

Search fields discarded duplicates before summing. A release with two
three-track mediums was indexed with a total of three tracks, so a
search for six tracks missed it.

Keep repeated values when summing release tracks and area references.
Other fields still deduplicate values in the order they are read.
Convert UUIDs to strings during collection so artist ID fields can
use the same logic.

Cover both deduplication modes and verify that a release with two
three-track mediums is indexed with six tracks.

Co-authored-by: junaid <shaikjunaid323@gmail.com>
Comment thread sir/schema/__init__.py
F("status", "status.name"),
F("tracks", "mediums.track_count",
transformfunc=sum),
transformfunc=sum, distinct=False),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracksrelease on SearchRecording also uses transformfunc=sum, I guess that has the same issue?

@mwiencek mwiencek Nov 26, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm not sure if/how tracksrelease works. The docs say it's "the number of tracks on any release (as a whole) including this recording," but that doesn't seem to be the same thing as summing tracks.medium.release.mediums.track_count, unless that groups by release before summing mediums.track_count. Edit: Anyway, that might be a separate issue from SEARCH-758.

Comment thread sir/schema/__init__.py
F("iso3", "iso_3166_3_codes.code"),
F("sortname", "aliases.sort_name"),
F("ref_count", ["place_count", "label_count", "artist_count"], transformfunc=tfs.integer_sum, trigger=False),
F("ref_count", ["place_count", "label_count", "artist_count"], transformfunc=tfs.integer_sum, trigger=False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a ref_count field on SearchArtist too, is that not affected?

@fettuccinae fettuccinae Nov 26, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its not affected because ref_count in SearchArtist depends on a single integer field artist_credit_names.artist_credit.ref_count.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but isn't that summing every ref_count for every artist credit the artist appears on? If two of those credits have the same ref_count, my understanding is that only one of the ref counts would be counted.

# `[none]` type barcode via the syntax `barcode:none`
if "" in values:
return values.add('none')
return values.append('none')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused why we'd want to append none multiple times, but I guess it's just because values is a list now.

But I also couldn't find none documented on the wiki, and it seems to not actually work? https://musicbrainz.org/ws/2/release/?query=barcode:none

@mwiencek mwiencek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct except for, possibly, fixing the other ref_count field. The other two issues are probably separate tickets.

@fettuccinae fettuccinae left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants