data

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
	}

	// 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,
	}
)
View Source
var (
	// SortOptions represent the list of all search sort options
	SortOptions = []Sort{Relevance, 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",
	}
)
View Source
var (
	// Categories represent the list of all search categories
	TopicCategories = []TopicCategory{Census}

	// Census - search information on census category
	Census = TopicCategory{
		LocaliseKeyName: "Census",
		Topics:          []Topic{DemographyAndMigration, Education, EthnicGroupNationalIdentityAndReligion, HealthDisabilityAndUnpaidCare, Housing, LabourMarketAndTravelToWork, SexualOrientationAndGenderIdentity, Veterans},
	}

	// Bulletin - Search information specific for statistical bulletins
	DemographyAndMigration = Topic{
		LocaliseKeyName: "DemographyAndMigration",
		Group:           "demography_and_migration",
		SubTopics:       []string{"demography_and_migration"},
		ShowInWebUI:     true,
	}

	// Education - Search information specific for Education
	Education = Topic{
		LocaliseKeyName: "Education",
		Group:           "education",
		SubTopics:       []string{"education"},
		ShowInWebUI:     true,
	}

	// EthnicGroupNationalIdentityAndReligion - Search information specific for ethnic groups, national identity and religion
	EthnicGroupNationalIdentityAndReligion = Topic{
		LocaliseKeyName: "EthnicGroupNationalIdentityAndReligion",
		Group:           "ethnic_group_national_identity_and_religion",
		SubTopics:       []string{"ethnic_group_national_identity_and_religion"},
		ShowInWebUI:     true,
	}

	// HealthDisabilityAndUnpaidCare - Search information specific for health, disabilities and unpaid care
	HealthDisabilityAndUnpaidCare = Topic{
		LocaliseKeyName: "HealthDisabilityAndUnpaidCare",
		Group:           "health_disability_and_unpaid_care",
		SubTopics:       []string{"health_disability_and_unpaid_care"},
		ShowInWebUI:     true,
	}

	// Housing - Search information specific for Housing
	Housing = Topic{
		LocaliseKeyName: "Housing",
		Group:           "housing",
		SubTopics:       []string{"housing"},
		ShowInWebUI:     true,
	}

	// LabourMarketAndTravelToWork - Search information specific for labour market and travel to work
	LabourMarketAndTravelToWork = Topic{
		LocaliseKeyName: "LabourMarketAndTravelToWork",
		Group:           "labour_market_and_travel_to_work",
		SubTopics:       []string{"labour_market_and_travel_to_work"},
		ShowInWebUI:     true,
	}

	// SexualOrientationAndGenderIdentity - Search information specific for sexual orientation and gender identity
	SexualOrientationAndGenderIdentity = Topic{
		LocaliseKeyName: "SexualOrientationAndGenderIdentity",
		Group:           "sexual_orientation_and_gender_identity",
		SubTopics:       []string{"sexual_orientation_and_gender_identity"},
		ShowInWebUI:     true,
	}

	// Veterans - Search information specific for Veterans
	Veterans = Topic{
		LocaliseKeyName: "Veteran",
		Group:           "veterans",
		SubTopics:       []string{"veterans"},
		ShowInWebUI:     true,
	}
)
View Source
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, validatedQueryParams SearchURLParams, totalPages int) []model.PageToDisplay

GetFirstAndLastPages gets the first and last pages

func GetGroupLocaliseKey added in v0.18.0

func GetGroupLocaliseKey(resultType string) string

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, 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) url.Values

GetSearchAPIQuery gets the query that needs to be passed to the search-api to get search results

func GetTopicGroupLocaliseKey added in v0.24.0

func GetTopicGroupLocaliseKey(resultType string) string

GetTopicGroupLocaliseKey gets the localise key of the group type of the search result to be displayed

func GetTotalPages added in v0.5.0

func GetTotalPages(cfg *config.Config, limit, count int) int

GetTotalPages gets the total pages of the 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 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 SearchURLParams added in v0.5.0

type SearchURLParams struct {
	Query       string
	Filter      Filter
	TopicFilter TopicFilter
	Sort        Sort
	Limit       int
	CurrentPage int
	Offset      int
}

SearchURLParams is a struct which contains all information of search url parameters and values

func ReviewQuery added in v0.5.0

func ReviewQuery(ctx context.Context, cfg *config.Config, urlQuery url.Values) (SearchURLParams, error)

ReviewQuery ensures that all search parameter values given by the user are reviewed

type Sort added in v0.5.0

type Sort struct {
	Query           string `json:"query"`
	LocaliseKeyName string `json:"localise_key"`
}

Sort represents information of a particular sort option

type Topic added in v0.24.0

type Topic struct {
	LocaliseKeyName string   `json:"localise_key"`
	Count           int      `json:"count"`
	Group           string   `json:"group"`
	SubTopics       []string `json:"subtopics"`
	ShowInWebUI     bool     `json:"show_in_web_ui"`
}

Topic represents the type of the search results and the number of results for each type

type TopicCategory added in v0.24.0

type TopicCategory struct {
	LocaliseKeyName string  `json:"localise_key"`
	Count           int     `json:"count"`
	Topics          []Topic `json:"topics"`
}

TopicCategory represents all the search categories in search page

func GetTopicCategories added in v0.24.0

func GetTopicCategories() []TopicCategory

GetTopicCategories returns all the categories and its content types where all the count is set to zero

type TopicFilter added in v0.24.0

type TopicFilter struct {
	Filter
}

Filter represents information of filters selected by user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL