diff --git a/firestore.indexes.json b/firestore.indexes.json index e42debd02..09a1c4e85 100644 --- a/firestore.indexes.json +++ b/firestore.indexes.json @@ -1,30 +1,5 @@ { "indexes": [ - //// Testimony Listing //// - { - "collectionGroup": "publishedTestimony", - "queryScope": "COLLECTION_GROUP", - "fields": [ - { - "fieldPath": "authorRole", - "order": "ASCENDING" - }, - { - "fieldPath": "billId", - "order": "ASCENDING" - }, - { - "fieldPath": "court", - "order": "ASCENDING" - }, - { - "fieldPath": "publishedAt", - "order": "DESCENDING" - } - ] - }, - - //// Publication cloud functions //// { "collectionGroup": "archivedTestimony", "queryScope": "COLLECTION", @@ -43,56 +18,14 @@ } ] }, - - { - "collectionGroup": "publishedTestimony", - "queryScope": "COLLECTION_GROUP", - "fields": [ - { - "fieldPath": "authorUid", - "order": "ASCENDING" - }, - { - "fieldPath": "billId", - "order": "ASCENDING" - } - ] - }, - - //// Bill Search //// - // No filter { "collectionGroup": "bills", "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "latestTestimonyAt", - "order": "DESCENDING" - }, - { - "fieldPath": "id", + "fieldPath": "city", "order": "ASCENDING" - } - ] - }, - { - "collectionGroup": "bills", - "queryScope": "COLLECTION", - "fields": [ - { - "fieldPath": "testimonyCount", - "order": "DESCENDING" }, - { - "fieldPath": "id", - "order": "ASCENDING" - } - ] - }, - { - "collectionGroup": "bills", - "queryScope": "COLLECTION", - "fields": [ { "fieldPath": "cosponsorCount", "order": "DESCENDING" @@ -108,8 +41,8 @@ "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "nextHearingAt", - "order": "DESCENDING" + "fieldPath": "city", + "order": "ASCENDING" }, { "fieldPath": "id", @@ -117,8 +50,6 @@ } ] }, - - // Filter by city { "collectionGroup": "bills", "queryScope": "COLLECTION", @@ -127,6 +58,10 @@ "fieldPath": "city", "order": "ASCENDING" }, + { + "fieldPath": "latestTestimonyAt", + "order": "DESCENDING" + }, { "fieldPath": "id", "order": "ASCENDING" @@ -142,7 +77,7 @@ "order": "ASCENDING" }, { - "fieldPath": "latestTestimonyAt", + "fieldPath": "nextHearingAt", "order": "DESCENDING" }, { @@ -174,7 +109,7 @@ "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "city", + "fieldPath": "content.PrimarySponsor.Id", "order": "ASCENDING" }, { @@ -192,21 +127,15 @@ "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "city", + "fieldPath": "content.PrimarySponsor.Id", "order": "ASCENDING" }, - { - "fieldPath": "nextHearingAt", - "order": "DESCENDING" - }, { "fieldPath": "id", "order": "ASCENDING" } ] }, - - // Filter by primary sponsor { "collectionGroup": "bills", "queryScope": "COLLECTION", @@ -215,6 +144,10 @@ "fieldPath": "content.PrimarySponsor.Id", "order": "ASCENDING" }, + { + "fieldPath": "latestTestimonyAt", + "order": "DESCENDING" + }, { "fieldPath": "id", "order": "ASCENDING" @@ -230,7 +163,7 @@ "order": "ASCENDING" }, { - "fieldPath": "latestTestimonyAt", + "fieldPath": "nextHearingAt", "order": "DESCENDING" }, { @@ -261,10 +194,6 @@ "collectionGroup": "bills", "queryScope": "COLLECTION", "fields": [ - { - "fieldPath": "content.PrimarySponsor.Id", - "order": "ASCENDING" - }, { "fieldPath": "cosponsorCount", "order": "DESCENDING" @@ -280,11 +209,11 @@ "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "content.PrimarySponsor.Id", + "fieldPath": "currentCommittee.id", "order": "ASCENDING" }, { - "fieldPath": "nextHearingAt", + "fieldPath": "cosponsorCount", "order": "DESCENDING" }, { @@ -293,8 +222,6 @@ } ] }, - - // Filter by current committee { "collectionGroup": "bills", "queryScope": "COLLECTION", @@ -336,7 +263,7 @@ "order": "ASCENDING" }, { - "fieldPath": "testimonyCount", + "fieldPath": "nextHearingAt", "order": "DESCENDING" }, { @@ -354,7 +281,7 @@ "order": "ASCENDING" }, { - "fieldPath": "cosponsorCount", + "fieldPath": "testimonyCount", "order": "DESCENDING" }, { @@ -368,21 +295,15 @@ "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "currentCommittee.id", + "fieldPath": "id", "order": "ASCENDING" }, { - "fieldPath": "nextHearingAt", + "fieldPath": "cosponsorCount", "order": "DESCENDING" - }, - { - "fieldPath": "id", - "order": "ASCENDING" } ] }, - - // Filter by bill ID { "collectionGroup": "bills", "queryScope": "COLLECTION", @@ -392,7 +313,7 @@ "order": "ASCENDING" }, { - "fieldPath": "cosponsorCount", + "fieldPath": "latestTestimonyAt", "order": "DESCENDING" } ] @@ -406,7 +327,7 @@ "order": "ASCENDING" }, { - "fieldPath": "latestTestimonyAt", + "fieldPath": "nextHearingAt", "order": "DESCENDING" } ] @@ -429,56 +350,68 @@ "collectionGroup": "bills", "queryScope": "COLLECTION", "fields": [ + { + "fieldPath": "latestTestimonyAt", + "order": "DESCENDING" + }, { "fieldPath": "id", "order": "ASCENDING" - }, + } + ] + }, + { + "collectionGroup": "bills", + "queryScope": "COLLECTION", + "fields": [ { "fieldPath": "nextHearingAt", "order": "DESCENDING" + }, + { + "fieldPath": "id", + "order": "ASCENDING" } ] }, - - //// Event Listing //// { - "collectionGroup": "events", + "collectionGroup": "bills", "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "type", - "order": "ASCENDING" + "fieldPath": "testimonyCount", + "order": "DESCENDING" }, { - "fieldPath": "startsAt", + "fieldPath": "id", "order": "ASCENDING" } ] }, - - //// Testimony Search //// - // No filters { - "collectionGroup": "publishedTestimony", - "queryScope": "COLLECTION_GROUP", + "collectionGroup": "events", + "queryScope": "COLLECTION", "fields": [ { - "fieldPath": "court", + "fieldPath": "type", "order": "ASCENDING" }, { - "fieldPath": "publishedAt", - "order": "DESCENDING" + "fieldPath": "startsAt", + "order": "ASCENDING" } ] }, - // Rep { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ { - "fieldPath": "representativeId", + "fieldPath": "authorRole", + "order": "ASCENDING" + }, + { + "fieldPath": "billId", "order": "ASCENDING" }, { @@ -491,30 +424,28 @@ } ] }, - // Sen { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ { - "fieldPath": "senatorId", + "fieldPath": "authorUid", "order": "ASCENDING" }, { - "fieldPath": "court", + "fieldPath": "billId", "order": "ASCENDING" - }, - { - "fieldPath": "publishedAt", - "order": "DESCENDING" } ] }, - // bill { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ + { + "fieldPath": "authorUid", + "order": "ASCENDING" + }, { "fieldPath": "billId", "order": "ASCENDING" @@ -529,11 +460,14 @@ } ] }, - // bill, rep { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ + { + "fieldPath": "authorUid", + "order": "ASCENDING" + }, { "fieldPath": "billId", "order": "ASCENDING" @@ -552,11 +486,14 @@ } ] }, - // bill, senator { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ + { + "fieldPath": "authorUid", + "order": "ASCENDING" + }, { "fieldPath": "billId", "order": "ASCENDING" @@ -575,7 +512,6 @@ } ] }, - // recent { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", @@ -584,13 +520,16 @@ "fieldPath": "authorUid", "order": "ASCENDING" }, + { + "fieldPath": "court", + "order": "ASCENDING" + }, { "fieldPath": "publishedAt", "order": "DESCENDING" } ] }, - // user { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", @@ -599,17 +538,12 @@ "fieldPath": "authorUid", "order": "ASCENDING" }, - { - "fieldPath": "court", - "order": "ASCENDING" - }, { "fieldPath": "publishedAt", "order": "DESCENDING" } ] }, - // user, Rep { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", @@ -632,7 +566,6 @@ } ] }, - // user, Sen { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", @@ -655,19 +588,36 @@ } ] }, - // user, bill { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ { - "fieldPath": "authorUid", + "fieldPath": "billId", "order": "ASCENDING" }, + { + "fieldPath": "court", + "order": "ASCENDING" + }, + { + "fieldPath": "publishedAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "publishedTestimony", + "queryScope": "COLLECTION_GROUP", + "fields": [ { "fieldPath": "billId", "order": "ASCENDING" }, + { + "fieldPath": "representativeId", + "order": "ASCENDING" + }, { "fieldPath": "court", "order": "ASCENDING" @@ -678,23 +628,32 @@ } ] }, - // user, bill, rep { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ { - "fieldPath": "authorUid", + "fieldPath": "billId", "order": "ASCENDING" }, { - "fieldPath": "billId", + "fieldPath": "senatorId", "order": "ASCENDING" }, { - "fieldPath": "representativeId", + "fieldPath": "court", "order": "ASCENDING" }, + { + "fieldPath": "publishedAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "publishedTestimony", + "queryScope": "COLLECTION_GROUP", + "fields": [ { "fieldPath": "court", "order": "ASCENDING" @@ -705,19 +664,28 @@ } ] }, - // user, bill, senator { "collectionGroup": "publishedTestimony", "queryScope": "COLLECTION_GROUP", "fields": [ { - "fieldPath": "authorUid", + "fieldPath": "representativeId", "order": "ASCENDING" }, { - "fieldPath": "billId", + "fieldPath": "court", "order": "ASCENDING" }, + { + "fieldPath": "publishedAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "publishedTestimony", + "queryScope": "COLLECTION_GROUP", + "fields": [ { "fieldPath": "senatorId", "order": "ASCENDING" @@ -748,57 +716,117 @@ } ], "fieldOverrides": [ - //// backfillTestimonyCounts //// { - "collectionGroup": "publishedTestimony", - "fieldPath": "court", + "collectionGroup": "activeTopicSubscriptions", + "fieldPath": "nextDigestAt", + "ttl": false, "indexes": [ - { "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "DESCENDING" }, - { "queryScope": "COLLECTION", "arrayConfig": "CONTAINS" } + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } ] }, - //// typesense //// { - "collectionGroup": "publishedTestimony", - "fieldPath": "id", + "collectionGroup": "activeTopicSubscriptions", + "fieldPath": "topicName", + "ttl": false, "indexes": [ - { "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "DESCENDING" }, - { "queryScope": "COLLECTION", "arrayConfig": "CONTAINS" } + { + "order": "ASCENDING", + "queryScope": "COLLECTION" + }, + { + "order": "DESCENDING", + "queryScope": "COLLECTION" + }, + { + "arrayConfig": "CONTAINS", + "queryScope": "COLLECTION" + }, + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } ] }, - { - "collectionGroup": "publishedTestimony", - "fieldPath": "publishedAt", - "indexes": [{ "queryScope": "COLLECTION_GROUP", "order": "DESCENDING" }] - }, { "collectionGroup": "bills", "fieldPath": "id", - "indexes": [{ "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }] + "ttl": false, + "indexes": [ + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } + ] }, { "collectionGroup": "publishedTestimony", "fieldPath": "authorUid", - "indexes": [{ "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }] + "ttl": false, + "indexes": [ + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } + ] }, - //// notifications //// { - "collectionGroup": "activeTopicSubscriptions", - "fieldPath": "nextDigestAt", - "indexes": [{ "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }] + "collectionGroup": "publishedTestimony", + "fieldPath": "court", + "ttl": false, + "indexes": [ + { + "order": "ASCENDING", + "queryScope": "COLLECTION" + }, + { + "order": "DESCENDING", + "queryScope": "COLLECTION" + }, + { + "arrayConfig": "CONTAINS", + "queryScope": "COLLECTION" + }, + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } + ] }, { - "collectionGroup": "activeTopicSubscriptions", - "fieldPath": "topicName", + "collectionGroup": "publishedTestimony", + "fieldPath": "id", + "ttl": false, + "indexes": [ + { + "order": "ASCENDING", + "queryScope": "COLLECTION" + }, + { + "order": "DESCENDING", + "queryScope": "COLLECTION" + }, + { + "arrayConfig": "CONTAINS", + "queryScope": "COLLECTION" + }, + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } + ] + }, + { + "collectionGroup": "publishedTestimony", + "fieldPath": "publishedAt", + "ttl": false, "indexes": [ - { "queryScope": "COLLECTION_GROUP", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "ASCENDING" }, - { "queryScope": "COLLECTION", "order": "DESCENDING" }, - { "queryScope": "COLLECTION", "arrayConfig": "CONTAINS" } + { + "order": "DESCENDING", + "queryScope": "COLLECTION_GROUP" + } ] } ] diff --git a/pull_request_template.md b/pull_request_template.md index 31351547e..b769537ee 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -8,6 +8,11 @@ _Add a short summary of the changes, and a reference to the original issue using - [ ] If I've added shared components, I've added a storybook story. - [ ] I've made pages responsive and look good on mobile. +For any new firestore queries, are all new required indexes: +- [ ] Created on development +- [ ] Created on production +- [ ] Added to firestore.indexes.json (either manually or with the command firebase firestore:indexes > firestore.indexes.json) + # Screenshots _Add some screenshots highlighting your changes._