Class SearchResource
java.lang.Object
org.ctan.site.resources.catalogue.api.SearchResource
The class
SearchResource
contains the controller for the search
resource.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
The classAuthorTo
contains the transport object for the author resource.protected static class
The classHitTo
contains the transport object for the search hit. -
Constructor Summary
ConstructorsConstructorDescriptionSearchResource
(@NonNull SearchService service) This is the constructor for the classSearchResource
. -
Method Summary
Modifier and TypeMethodDescriptionsearch
(@NonNull String phrase, int offset, int max, Boolean ext, Boolean includePkg, Boolean includeAuthors, Boolean includeTopics, Boolean includeSite) The methodsearch
provides means to trigger the JSON search end-point.searchXml
(@NonNull String phrase, int offset, int max, Boolean ext, Boolean includePkg, Boolean includeAuthors, Boolean includeTopics, Boolean includeSite) The methodsearchXml
provides means to trigger the XML search end-point.
-
Constructor Details
-
SearchResource
This is the constructor for the classSearchResource
.- 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 methodsearch
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 eithertrue
orfalse
. For any other value the behavior is undefined. If the value isfalse
then all default sections are searched. Otherwise the sections to be searched have to be specified with additional parameters. The default for this parameter isfalse
.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 isfalse
.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 isfalse
.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 isfalse
.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 isfalse
.- 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 methodsearchXml
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 eithertrue
orfalse
. For any other value the behavior is undefined. If the value isfalse
then all default sections are searched. Otherwise the sections to be searched have to be specified with additional parameters. The default for this parameter isfalse
.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 isfalse
.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 isfalse
.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 isfalse
.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 isfalse
.- Returns:
- a page
-