Package org.wso2.carbon.registry.admin.api.search

## Interface ISearchService<SearchResultsBean,​AdvancedSearchResultsBean,​CustomSearchParameterBean,​MediaTypeValueList>

- Type Parameters:
    `CustomSearchParameterBean` - a bean containing search parameters.
    `SearchResultsBean` - a bean storing results of basic search (tag search)
    `AdvancedSearchResultsBean` - a bean storing results of advanced search

      public interface ISearchService<SearchResultsBean,​AdvancedSearchResultsBean,​CustomSearchParameterBean,​MediaTypeValueList>

  This provides functionality to search resources available in the registry by meta-data.

  Using service clients for SearchService

  When using generated clients to access SearchService, ArrayOfString objects have to be used as demonstrated in the following example.

  Example : Searching resources created by "admin" and having "foo" as a property name

  `CustomSearchParameterBean parameterBean = new CustomSearchParameterBean();
  ArrayOfString[] aos = new ArrayOfString[2]; // No. of parameters to be passed is 2, namely author and property name
  aos[0] = new ArrayOfString();
  aos[0].addArray("author"); // search parameter name
  aos[0].addArray("admin"); // search parameter value
  aos[1] = new ArrayOfString();
  aos[1].addArray("propertyName"); // search parameter name
  aos[1].addArray("foo"); // search parameter value
  parameterBean.setParameterValues(aos);
  SearchAdminServiceStub ssClient = createSearchService(cookie, serverURL, configContext);
  AdvancedSearchResultsBean bean = ssClient.getAdvancedSearchResults(parameterBean);
  `

  CustomParameterBean encapsulates an ArrayOfString array which will contain all the parameters to be sent to SearchService. Altogether, this array can have up to 13 elements each representing "resourcePath", "author", "updater", "createdAfter", "createdBefore", "updatedAfter", "updatedBefore", "commentWords", "tags", "propertyName", "propertyValue", "content" or "mediaType". In the above case only "author" and "propertyName" have been used.

  Each element should be an ArrayOfString object which has the parameter name (one of the 13 listed above) as the zeroth element and corresponding parameter value (search key) as the 1st element.

  Statistics:

  - getSearchResults
  - getAdvancedSearchResults

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `deleteFilter​(String filterName)` | Delete a selected filter
    `CustomSearchParameterBean` | `getAdvancedSearchFilter​(String filterName)` | Returns the filter to populate advanced search fields
    `AdvancedSearchResultsBean` | `getAdvancedSearchResults​(CustomSearchParameterBean parameters)` | This method generates a search query according to parameters passed, and runs this query against the Registry and returns matching resutls
    `MediaTypeValueList` | `getMediaTypeSearch​(String mediaType)` | Returns the
    `String[]` | `getSavedFilters()` | Return names of all saved filters
    `SearchResultsBean` | `getSearchResults​(String searchType, String criteria)` | This method generates a search query that runs against the Registry and returns matching results
    `void` | `saveAdvancedSearchFilter​(CustomSearchParameterBean queryBean, String filterName)` | Saves the advanced search fields as a filter for later retrieval

- - ### Method Detail

    - #### getSearchResults

          SearchResultsBean getSearchResults​(String searchType,
                                             String criteria)
                                      throws org.wso2.carbon.registry.core.exceptions.RegistryException

      This method generates a search query that runs against the Registry and returns matching results
      Parameters:
        `searchType` - - String which indicates whether the search is a 'tag' search or a 'content' search
        `criteria` - - The actual tags or content that needs to be searched for
      Returns:
        a bean containing an array of resource data of the results
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - - if Registry is not available

    - #### getAdvancedSearchResults

          AdvancedSearchResultsBean getAdvancedSearchResults​(CustomSearchParameterBean parameters)
                                                      throws org.wso2.carbon.registry.core.exceptions.RegistryException

      This method generates a search query according to parameters passed, and runs this query against the Registry and returns matching resutls
      Parameters:
        `parameters` - - Bean which contains a 2D array with parameters and their respective values
      Returns:
        a bean containing an array of resource data of the results
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - - if Registry is not available

    - #### getMediaTypeSearch

          MediaTypeValueList getMediaTypeSearch​(String mediaType)
                                         throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Returns the
      Parameters:
        `mediaType` - - String containing the media type. Ex: "application/xml"
      Returns:
        MediaTypeValueList
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### saveAdvancedSearchFilter

          void saveAdvancedSearchFilter​(CustomSearchParameterBean queryBean,
                                        String filterName)
                                 throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Saves the advanced search fields as a filter for later retrieval
      Parameters:
        `queryBean` - - Bean with parameters and their respective values
        `filterName` - - Name to be saved for this filter
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - - if Registry is not available

    - #### getAdvancedSearchFilter

          CustomSearchParameterBean getAdvancedSearchFilter​(String filterName)
                                                     throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Returns the filter to populate advanced search fields
      Parameters:
        `filterName` - - Saved filter name
      Returns:
        - Bean with parameters and their respective values
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### getSavedFilters

          String[] getSavedFilters()
                            throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Return names of all saved filters
      Returns:
        Array of String containing all saved filter names
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### deleteFilter

          void deleteFilter​(String filterName)
                     throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Delete a selected filter
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`