Documentation
¶
Index ¶
- Variables
- func GetFirstAndLastPages(cfg *config.Config, req http.Request, validatedQueryParams SearchURLParams, ...) []model.PageToDisplay
- func GetGroupLocaliseKey(resultType string) string
- func GetPagesToDisplay(cfg *config.Config, req http.Request, validatedQueryParams SearchURLParams, ...) []model.PageToDisplay
- func GetSearchAPIQuery(validatedQueryParams SearchURLParams, censusTopicCache *cache.Topic) url.Values
- func GetTotalPages(cfg *config.Config, limit, count int) int
- type Category
- type ContentType
- type Dimensions
- type Filter
- type PopulationTypes
- type SearchURLParams
- type Sort
- type Subtopic
- type Topic
Constants ¶
This section is empty.
Variables ¶
var ( // Categories represent the list of all search categories Categories = []Category{Publication, Data, Other} // Publication - search information on publication category Publication = Category{ LocaliseKeyName: "Publication", ContentTypes: []ContentType{Bulletin, Article, Compendium}, } // Data - search information on data category Data = Category{ LocaliseKeyName: "Data", ContentTypes: []ContentType{TimeSeries, Datasets, UserRequestedData}, } // Other - search information on other categories Other = Category{ LocaliseKeyName: "Other", ContentTypes: []ContentType{Methodology, CorporateInformation, ProductPage}, } // Bulletin - Search information specific for statistical bulletins Bulletin = ContentType{ LocaliseKeyName: "StatisticalBulletin", Group: "bulletin", Types: []string{"bulletin"}, ShowInWebUI: true, } // Article - Search information specific for articles Article = ContentType{ LocaliseKeyName: "Article", Group: "article", Types: []string{"article", "article_download"}, ShowInWebUI: true, } // Compendium - Search information specific for compendium Compendium = ContentType{ LocaliseKeyName: "Compendium", Group: "compendia", Types: []string{"compendium_landing_page"}, ShowInWebUI: true, } // TimeSeries - Search information specific for time series TimeSeries = ContentType{ LocaliseKeyName: "TimeSeries", Group: "time_series", Types: []string{"timeseries"}, ShowInWebUI: true, } // Datasets - Search information specific for datasets Datasets = ContentType{ LocaliseKeyName: "Datasets", Group: "datasets", Types: []string{"dataset_landing_page", "timeseries_dataset"}, ShowInWebUI: true, } DatasetLandingPage = ContentType{ LocaliseKeyName: "Datasets", Group: "dataset_landing_page", Types: []string{"dataset_landing_page"}, ShowInWebUI: true, } // UserRequestedData - Search information specific for user requested data UserRequestedData = ContentType{ LocaliseKeyName: "UserRequestedData", Group: "user_requested_data", Types: []string{"static_adhoc"}, ShowInWebUI: true, } // Methodology - Search information specific for methodologies Methodology = ContentType{ LocaliseKeyName: "Methodology", Group: "methodology", Types: []string{"static_methodology", "static_methodology_download", "static_qmi"}, ShowInWebUI: true, } // CorporateInformation - Search information specific for corporate information CorporateInformation = ContentType{ LocaliseKeyName: "CorporateInformation", Group: "corporate_information", Types: []string{"static_foi", "static_page", "static_landing_page", "static_article"}, ShowInWebUI: true, } // ProductPage - Search information specific for product pages ProductPage = ContentType{ LocaliseKeyName: "ProductPage", Group: "product_page", Types: []string{"product_page"}, ShowInWebUI: false, } )
var ( // SortOptions represent the list of all search sort options SortOptions = []Sort{Relevance, ReleaseDate, Title} DatasetSortOptions = []Sort{ReleaseDate, Title} // Relevance - informing on sorting based on relevance Relevance = Sort{ Query: "relevance", LocaliseKeyName: "Relevance", } // ReleaseDate - informing on sorting based on release date ReleaseDate = Sort{ Query: "release_date", LocaliseKeyName: "ReleaseDate", } // Title - informing on sorting based on title Title = Sort{ Query: "title", LocaliseKeyName: "Title", } )
var LimitOptions = []int{
10,
25,
50,
}
LimitOptions contains all available limit parameter values
Functions ¶
func GetFirstAndLastPages ¶ added in v0.18.0
func GetFirstAndLastPages(cfg *config.Config, req http.Request, validatedQueryParams SearchURLParams, totalPages int) []model.PageToDisplay
GetFirstAndLastPages gets the first and last pages
func GetGroupLocaliseKey ¶ added in v0.18.0
GetGroupLocaliseKey gets the localise key of the group type of the search result to be displayed
func GetPagesToDisplay ¶ added in v0.5.0
func GetPagesToDisplay(cfg *config.Config, req http.Request, validatedQueryParams SearchURLParams, totalPages int) []model.PageToDisplay
GetPagesToDisplay gets all the pages available for the search results
func GetSearchAPIQuery ¶ added in v0.5.0
func GetSearchAPIQuery(validatedQueryParams SearchURLParams, censusTopicCache *cache.Topic) url.Values
GetSearchAPIQuery gets the query that needs to be passed to the search-api to get search results
Types ¶
type Category ¶
type Category struct { LocaliseKeyName string `json:"localise_key"` Count int `json:"count"` ContentTypes []ContentType `json:"content_types"` }
Category represents all the search categories in search page
func GetCategories ¶ added in v0.5.0
func GetCategories() []Category
GetCategories returns all the categories and its content types where all the count is set to zero
type ContentType ¶
type ContentType struct { LocaliseKeyName string `json:"localise_key"` Count int `json:"count"` Group string `json:"group"` Types []string `json:"types"` ShowInWebUI bool `json:"show_in_web_ui"` }
ContentType represents the type of the search results and the number of results for each type
type Dimensions ¶ added in v0.41.0
type Dimensions struct { LocaliseKeyName string `json:"localise_key"` Count int `json:"count"` Type string `json:"string"` Query string `json:"query"` ShowInWebUI bool `json:"show_in_web_ui"` }
func GetDimensions ¶ added in v0.41.0
func GetDimensions(countResp *searchModels.SearchResponse) (dimensions []Dimensions)
type Filter ¶ added in v0.5.0
type Filter struct { Query []string `json:"query,omitempty"` LocaliseKeyName []string `json:"localise_key,omitempty"` }
Filter represents information of filters selected by user
type PopulationTypes ¶ added in v0.41.0
type PopulationTypes struct { LocaliseKeyName string `json:"localise_key"` Count int `json:"count"` Type string `json:"string"` Query string `json:"query"` ShowInWebUI bool `json:"show_in_web_ui"` }
func GetPopulationTypes ¶ added in v0.41.0
func GetPopulationTypes(countResp *searchModels.SearchResponse) (populationTypes []PopulationTypes)
type SearchURLParams ¶ added in v0.5.0
type SearchURLParams struct { Query string PopulationTypeFilter string DimensionsFilter string Filter Filter TopicFilter string Sort Sort Limit int CurrentPage int Offset int }
SearchURLParams is a struct which contains all information of search url parameters and values
type Subtopic ¶ added in v0.34.0
type Subtopic struct { Count int `json:"count"` LocaliseKeyName string `json:"localise_key"` Query string `json:"query"` ShowInWebUI bool `json:"show_in_web_ui"` }
Subtopic represents a subtopic filter on the search page
type Topic ¶ added in v0.24.0
type Topic struct { Count int `json:"count"` DistinctItemsCount int `json:"distinct_items_count"` LocaliseKeyName string `json:"localise_key"` Query string `json:"query"` ShowInWebUI bool `json:"show_in_web_ui"` Subtopics []Subtopic `json:"subtopics"` }
Topic represents a topic filter on the search page
func GetTopics ¶ added in v0.34.0
func GetTopics(censusTopicCache *cache.Topic, countResp *searchModels.SearchResponse) []Topic
GetTopicCategories returns the topic filters to be displayed on the search page. Please note that only census topic filter is being returned