Skip to content

Commit 019c1cd

Browse files
committed
SEARCH-680: Index genre annotations
1 parent dff0a11 commit 019c1cd

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

sir/schema/__init__.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,24 @@
4040
SearchAnnotation = E(modelext.CustomAnnotation, [
4141
F("id", "id"),
4242
F("entity", ["areas.area.gid", "artists.artist.gid", "events.event.gid",
43-
"instruments.instrument.gid", "labels.label.gid",
44-
"places.place.gid", "recordings.recording.gid",
45-
"releases.release.gid", "release_groups.release_group.gid",
43+
"genres.genre.gid", "instruments.instrument.gid",
44+
"labels.label.gid", "places.place.gid",
45+
"recordings.recording.gid", "releases.release.gid",
46+
"release_groups.release_group.gid",
4647
"series.series.gid", "works.work.gid"]),
4748
F("name", ["areas.area.name", "artists.artist.name", "events.event.name",
48-
"instruments.instrument.name", "labels.label.name",
49-
"places.place.name", "recordings.recording.name",
50-
"releases.release.name", "release_groups.release_group.name",
49+
"genres.genre.name", "instruments.instrument.name",
50+
"labels.label.name", "places.place.name",
51+
"recordings.recording.name", "releases.release.name",
52+
"release_groups.release_group.name",
5153
"series.series.name", "works.work.name"]),
5254
F("text", "text"),
5355
F("type", ["areas.__tablename__", "artists.__tablename__",
54-
"events.__tablename__", "instruments.__tablename__",
55-
"labels.__tablename__", "places.__tablename__",
56-
"recordings.__tablename__", "releases.__tablename__",
57-
"release_groups.__tablename__", "series.__tablename__",
58-
"works.__tablename__"],
56+
"events.__tablename__", "genres.__tablename__",
57+
"instruments.__tablename__", "labels.__tablename__",
58+
"places.__tablename__", "recordings.__tablename__",
59+
"releases.__tablename__", "release_groups.__tablename__",
60+
"series.__tablename__", "works.__tablename__"],
5961
transformfunc=tfs.annotation_type)
6062
],
6163
1.5,

sir/schema/modelext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CustomAnnotation(Annotation):
2222
areas = relationship("AreaAnnotation")
2323
artists = relationship("ArtistAnnotation")
2424
events = relationship("EventAnnotation")
25+
genres = relationship("GenreAnnotation")
2526
instruments = relationship("InstrumentAnnotation")
2627
labels = relationship("LabelAnnotation")
2728
places = relationship("PlaceAnnotation")

sir/schema/queryext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# Copyright (c) 2015 Wieland Hoffmann
44
# License: MIT, see LICENSE for details
55
from mbdata.models import (Annotation, AreaAnnotation, ArtistAnnotation,
6-
EventAnnotation, InstrumentAnnotation, LabelAnnotation,
6+
EventAnnotation, GenreAnnotation,
7+
InstrumentAnnotation, LabelAnnotation,
78
PlaceAnnotation, RecordingAnnotation, ReleaseAnnotation,
89
ReleaseGroupAnnotation, SeriesAnnotation, WorkAnnotation)
910
from sqlalchemy import func
@@ -13,6 +14,7 @@
1314
AreaAnnotation,
1415
ArtistAnnotation,
1516
EventAnnotation,
17+
GenreAnnotation,
1618
InstrumentAnnotation,
1719
LabelAnnotation,
1820
PlaceAnnotation,

sir/schema/transformfuncs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"area_annotation": "area",
88
"artist_annotation": "artist",
99
"event_annotation": "event",
10+
"genre_annotation": "genre",
1011
"instrument_annotation": "instrument",
1112
"label_annotation": "label",
1213
"place_annotation": "place",

sir/wscompat/convert.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ def convert_annotation(obj):
761761
l.append(convert_one_annotation(obj, 'artist', a.artist))
762762
for a in obj.events:
763763
l.append(convert_one_annotation(obj, 'event', a.event))
764+
for a in obj.genres:
765+
l.append(convert_one_annotation(obj, 'genre', a.genre))
764766
for a in obj.instruments:
765767
l.append(convert_one_annotation(obj, 'instrument', a.instrument))
766768
for a in obj.labels:

0 commit comments

Comments
 (0)