@@ -500,6 +500,20 @@ class Meta:
500500
501501 organization_name_lower = UnicodeAttribute (hash_key = True )
502502
503+ class OrganizationNameLowerSearchIndex (GlobalSecondaryIndex ):
504+ """
505+ This class represents a global secondary index for querying organizations by Organization Name.
506+ """
507+
508+ class Meta :
509+ """Meta class for external ID github org index."""
510+
511+ index_name = "organization-name-lower-search-index"
512+ write_capacity_units = int (cla .conf ["DYNAMO_WRITE_UNITS" ])
513+ read_capacity_units = int (cla .conf ["DYNAMO_READ_UNITS" ])
514+ projection = AllProjection ()
515+
516+ organization_name_lower = UnicodeAttribute (hash_key = True )
503517
504518class GitlabExternalGroupIDIndex (GlobalSecondaryIndex ):
505519 """
@@ -3817,7 +3831,8 @@ class Meta:
38173831 project_sfid = UnicodeAttribute ()
38183832 organization_sfid_index = GitlabOrgSFIndex ()
38193833 project_sfid_organization_name_index = GitlabOrgProjectSfidOrganizationNameIndex ()
3820- organization_name_lowe_index = GitlabOrganizationNameLowerIndex ()
3834+ organization_name_lower_index = GitlabOrganizationNameLowerIndex ()
3835+ organization_name_lower_search_index = OrganizationNameLowerSearchIndex ()
38213836 organization_project_id = UnicodeAttribute (null = True )
38223837 organization_company_id = UnicodeAttribute (null = True )
38233838 auto_enabled = BooleanAttribute (null = True )
@@ -3964,7 +3979,7 @@ def get_organization_by_installation_id(self, installation_id):
39643979 return None
39653980
39663981 def get_organization_by_lower_name (self , organization_name ):
3967- org_generator = self .model .scan ( organization_name_lower__eq = organization_name .lower ())
3982+ org_generator = self .model .organization_name_lower_search_index . query ( organization_name .lower ())
39683983 for org_model in org_generator :
39693984 org = GitHubOrg ()
39703985 org .model = org_model
0 commit comments