Index Tool for Search #107
@ -115,12 +115,12 @@ class Services(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def service_types_with_doc_types(self, environment=None):
 | 
					    def service_types_with_doc_types(self, environment=None):
 | 
				
			||||||
        """Retrieve type and title from services and corresponding docs.
 | 
					        """Retrieve type and title from services and corresponding docs.
 | 
				
			||||||
            As well as a list of all doc_types.
 | 
					            As well as a list of all available doc types with title.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        :param str environment: Optional service environment.
 | 
					        :param str environment: Optional service environment.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        service_list = []
 | 
					        service_list = []
 | 
				
			||||||
        doc_types = []
 | 
					        docs = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for service in self.all_services:
 | 
					        for service in self.all_services:
 | 
				
			||||||
            if not service["service_title"]:
 | 
					            if not service["service_title"]:
 | 
				
			||||||
@ -139,8 +139,15 @@ class Services(object):
 | 
				
			|||||||
                        "type": doc["type"]
 | 
					                        "type": doc["type"]
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if doc["type"] not in doc_types:
 | 
					                new_doc = {
 | 
				
			||||||
                    doc_types.append(doc["type"])
 | 
					                    "type": doc["type"],
 | 
				
			||||||
 | 
					                    "title": doc["title"]
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                type_exists = any(
 | 
				
			||||||
 | 
					                    doc_dict["type"] == new_doc["type"] for doc_dict in docs
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					                if not type_exists:
 | 
				
			||||||
 | 
					                    docs.append(new_doc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            service_list.append({
 | 
					            service_list.append({
 | 
				
			||||||
                "service_title": service["service_title"],
 | 
					                "service_title": service["service_title"],
 | 
				
			||||||
@ -150,7 +157,7 @@ class Services(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        res = {
 | 
					        res = {
 | 
				
			||||||
            "services": service_list,
 | 
					            "services": service_list,
 | 
				
			||||||
            "doc_types": doc_types
 | 
					            "docs": docs
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return res
 | 
					        return res
 | 
				
			||||||
 | 
				
			|||||||
@ -4,3 +4,4 @@ requests
 | 
				
			|||||||
jinja2
 | 
					jinja2
 | 
				
			||||||
dirsync
 | 
					dirsync
 | 
				
			||||||
cookiecutter
 | 
					cookiecutter
 | 
				
			||||||
 | 
					opensearch-py
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										151
									
								
								tools/index_metadata.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								tools/index_metadata.py
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user