Class SearchResource

java.lang.Object
org.ctan.site.resources.catalogue.api.SearchResource

@Path("/") public class SearchResource extends Object
The class SearchResource contains the controller for the search resource.
  • Constructor Details

    • SearchResource

      public SearchResource(@NonNull @NonNull SearchService service)
      This is the constructor for the class SearchResource.
      Parameters:
      service - the underlying service
  • Method Details

    • search

      @GET @Path("/search/json") @Produces("application/json") @PermitAll public SearchResource.HitsPage search(@NonNull @PathParam("phrase") @NonNull String phrase, @PathParam("offset") int offset, @PathParam("max") int max, @QueryParam("ext") @DefaultValue("false") Boolean ext, @QueryParam("PKG") @DefaultValue("false") Boolean includePkg, @QueryParam("AUTHORS") @DefaultValue("false") Boolean includeAuthors, @QueryParam("TOPICS") @DefaultValue("false") Boolean includeTopics, @QueryParam("PORTAL") @DefaultValue("false") Boolean includeSite)
      The method search provides means to trigger the JSON search end-point.
      Parameters:
      phrase - The parameter phrase contains the search phrase, i.e. the words or search expressions to query for.
      offset - This is the offset for paging. The accompanying parameter max contains the page size. This parameter contains the first hit to be returned. It is a number greater or equal to 0. If a negative number is passed in then it is replaced by 0. If the offset is larger than the number of actual hits then the list of hits will be empty.
      max - This parameter determines the number of hits maximally returned. It is a number in the range 1 to 256. Larger values will be reduced to 256. Lower values will be replaced by the default value. If this parameter is omitted then the default value 16 will be used.
      ext - This parameter determines whether the sections are requested explicitly. The value is either true or false. For any other value the behavior is undefined. If the value is false then all default sections are searched. Otherwise the sections to be searched have to be specified with additional parameters. The default for this parameter is false.
      includePkg - This parameter determines whether the package section should be included into the search. The package section contains the text fields of a package entry in the Catalogue. The default for this parameter is false.
      includeAuthors - This parameter determines whether the author section should be included into the search. The author section contains the names of the contributors in the Catalogue. The default for this parameter is false.
      includeTopics - This parameter determines whether the topics section should be included into the search. The topics section contains the text fields of the topics in the Catalogue. The default for this parameter is false.
      includeSite - This parameter determines whether the site section should be included into the search. The site section contains the text of the site pages. The default for this parameter is false.
      Returns:
      a page
    • searchXml

      @GET @Path("/search/xml") @Produces("application/xml") @PermitAll public String searchXml(@NonNull @PathParam("phrase") @NonNull String phrase, @PathParam("offset") int offset, @PathParam("max") int max, @QueryParam("ext") @DefaultValue("false") Boolean ext, @QueryParam("PKG") @DefaultValue("false") Boolean includePkg, @QueryParam("AUTHORS") @DefaultValue("false") Boolean includeAuthors, @QueryParam("TOPICS") @DefaultValue("false") Boolean includeTopics, @QueryParam("PORTAL") @DefaultValue("false") Boolean includeSite)
      The method searchXml provides means to trigger the XML search end-point.
      Parameters:
      phrase - The parameter phrase contains the search phrase, i.e. the words or search expressions to query for.
      offset - This is the offset for paging. The accompanying parameter max contains the page size. This parameter contains the first hit to be returned. It is a number greater or equal to 0. If a negative number is passed in then it is replaced by 0. If the offset is larger than the number of actual hits then the list of hits will be empty.
      max - This parameter determines the number of hits maximally returned. It is a number in the range 1 to 256. Larger values will be reduced to 256. Lower values will be replaced by the default value. If this parameter is omitted then the default value 16 will be used.
      ext - This parameter determines whether the sections are requested explicitly. The value is either true or false. For any other value the behavior is undefined. If the value is false then all default sections are searched. Otherwise the sections to be searched have to be specified with additional parameters. The default for this parameter is false.
      includePkg - This parameter determines whether the package section should be included into the search. The package section contains the text fields of a package entry in the Catalogue. The default for this parameter is false.
      includeAuthors - This parameter determines whether the author section should be included into the search. The author section contains the names of the contributors in the Catalogue. The default for this parameter is false.
      includeTopics - This parameter determines whether the topics section should be included into the search. The topics section contains the text fields of the topics in the Catalogue. The default for this parameter is false.
      includeSite - This parameter determines whether the site section should be included into the search. The site section contains the text of the site pages. The default for this parameter is false.
      Returns:
      a page