Package gov.niem.tools.api.search
Class SearchController
java.lang.Object
gov.niem.tools.api.search.SearchController
REST controller for database searches for NIEM and community model content.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPropertySearch
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String niemVersionNumber, String[] token, String[] substring, String[] prefix, String[] type, Boolean isAbstract, Boolean isElement, Integer offset, Integer limit) Search properties based on the given criteria.getPropertySearchCmf
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String niemVersionNumber, String[] token, String[] substring, String[] prefix, String[] type, Boolean isAbstract, Boolean isElement, Integer offset, Integer limit, Config.AppMediaType mediaType) Search properties in the database based on the given criteria and return results in CMF.getTypeSearch
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String niemVersionNumber, String[] token, String[] substring, String[] prefix, Integer offset, Integer limit) Search types based on given criteria.getTypeSearchCmf
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String niemVersionNumber, String[] token, String[] substring, String[] prefix, Integer offset, Integer limit, Config.AppMediaType mediaType) Search types based on given criteria and returns results in CMF.void
index()
-
Constructor Details
-
SearchController
public SearchController()
-
-
Method Details
-
index
@GetMapping("/search/index") public void index() -
getPropertySearch
@GetMapping("/search/properties") @ResponseStatus(code=OK) public List<Property> getPropertySearch(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestParam(required=false) String niemVersionNumber, @RequestParam(required=false) String[] token, @RequestParam(required=false) String[] substring, @RequestParam(required=false) String[] prefix, @RequestParam(required=false) String[] type, @RequestParam(required=false) Boolean isAbstract, @RequestParam(required=false) Boolean isElement, @RequestParam(required=false) Integer offset, @RequestParam(required=false) Integer limit) Search properties based on the given criteria.- Parameters:
niemVersionNumber
- A base NIEM version number (e.g., "5.2") to search for NIEM and community content. Defaults to the current NIEM version if not provided.token
- Search for full tokens in component names and definitions with stemming. Example: "arm" returns property names with "Arm", "Armed", and "Arming" but does not return "Alarm", "Firearm", "Harm", etc.substring
- Search for partial text in component names and definitions. Example: "arm" returns property names with "Arm", "Armed", "Arming", "Alarm", "Firearm", "Harm", etc.prefix
- Filter results on the given prefix(es)type
- Filter results by substring matching on one of the given types. Example: ["text", "boolean"] matches properties with types that include nc:TextType and niem-xs:boolean.isAbstract
- True if only abstract properties should be returned; false if only non-abstract (concrete) properties should be returned. Omit parameter to return either kind.isElement
- True if only element properties should be returned; false if only attribute properties should be returned. Omit parameter to return either kind.offset
- A number of results to skip. Defaults to 0.limit
- A maximum number of results to return. Defaults to and will not exceed 100.
-
getPropertySearchCmf
@GetMapping("/search.cmf/properties") @ResponseStatus(code=OK) public Object getPropertySearchCmf(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestParam(required=false) String niemVersionNumber, @RequestParam(required=false) String[] token, @RequestParam(required=false) String[] substring, @RequestParam(required=false) String[] prefix, @RequestParam(required=false) String[] type, @RequestParam(required=false) Boolean isAbstract, @RequestParam(required=false) Boolean isElement, @RequestParam(required=false) Integer offset, @RequestParam(required=false) Integer limit, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Search properties in the database based on the given criteria and return results in CMF.- Parameters:
niemVersionNumber
- A base NIEM version number (e.g., "5.2") to search for NIEM and community content. Defaults to the current NIEM version if not provided.token
- Search for full tokens in component names and definitions with stemming. Example: "arm" returns property names with "Arm", "Armed", and "Arming" but does not return "Alarm", "Firearm", "Harm", etc.substring
- Search for partial text in component names and definitions. Example: "arm" returns property names with "Arm", "Armed", "Arming", "Alarm", "Firearm", "Harm", etc.prefix
- Filter results on the given prefix(es)type
- Filter results by substring matching on one of the given types. Example: ["text", "boolean"] matches properties with types that include nc:TextType and niem-xs:boolean.isAbstract
- True if only abstract properties should be returned; false if only non-abstract (concrete) properties should be returned. Omit parameter to return either kind.isElement
- True if only element properties should be returned; false if only attribute properties should be returned. Omit parameter to return either kind.offset
- A number of results to skip. Defaults to 0.limit
- A maximum number of results to return. Defaults to and will not exceed 100.- Throws:
Exception
-
getTypeSearch
@GetMapping("/search/types") @ResponseStatus(code=OK) public List<Type> getTypeSearch(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestParam(required=false) String niemVersionNumber, @RequestParam(required=false) String[] token, @RequestParam(required=false) String[] substring, @RequestParam(required=false) String[] prefix, @RequestParam(required=false) Integer offset, @RequestParam(required=false) Integer limit) Search types based on given criteria.- Parameters:
niemVersionNumber
- A base NIEM version number (e.g., "5.2") to search for NIEM and community content. Defaults to the current NIEM version if not provided.token
- Search for full tokens in component names and definitions with stemming. Example: "arm" returns property names with "Arm", "Armed", and "Arming" but does not return "Alarm", "Firearm", "Harm", etc.substring
- Search for partial text in component names and definitions. Example: "arm" returns property names with "Arm", "Armed", "Arming", "Alarm", "Firearm", "Harm", etc.prefix
- Filter results on the given prefix(es)offset
- A number of results to skip. Defaults to 0.limit
- A maximum number of results to return. Defaults to and will not exceed 100.
-
getTypeSearchCmf
@GetMapping("/search.cmf/types") @ResponseStatus(code=OK) public Object getTypeSearchCmf(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestParam(required=false) String niemVersionNumber, @RequestParam(required=false) String[] token, @RequestParam(required=false) String[] substring, @RequestParam(required=false) String[] prefix, @RequestParam(required=false) Integer offset, @RequestParam(required=false) Integer limit, @RequestParam(required=false,defaultValue="json") Config.AppMediaType mediaType) throws Exception Search types based on given criteria and returns results in CMF.- Parameters:
niemVersionNumber
- A base NIEM version number (e.g., "5.2") to search for NIEM and community content. Defaults to the current NIEM version if not provided.token
- Search for full tokens in component names and definitions with stemming. Example: "arm" returns property names with "Arm", "Armed", and "Arming" but does not return "Alarm", "Firearm", "Harm", etc.substring
- Search for partial text in component names and definitions. Example: "arm" returns property names with "Arm", "Armed", "Arming", "Alarm", "Firearm", "Harm", etc.prefix
- Filter results on the given prefix(es)offset
- A number of results to skip. Defaults to 0.limit
- A maximum number of results to return. Defaults to and will not exceed 100.- Throws:
Exception
-