schema

package
v0.260.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// FeedsIndex is the index containing [model.Feed] documents.
	FeedsIndex opensearch.Index = "feeds"
	// ItemsIndex is the index containing [models.Item] documents.
	ItemsIndex opensearch.Index = "items"
	// FavoritesIndex is the index containing [models.Article] that a user has favorited.
	FavoritesIndex opensearch.Index = "favorites"
	// UsersIndex is the index containing [model.User] documents.
	UsersIndex opensearch.Index = "users"
	// SubscriptionsIndex is the index containing [models.Subscription] documents.
	SubscriptionsIndex opensearch.Index = "subscriptions"
	// SchedulerIndex is the index containing data for scheduled jobs and job data.
	SchedulerIndex opensearch.Index = "scheduler"
	// SessionsIndex is the index containing user session data.
	SessionsIndex opensearch.Index = "sessions"
	// ImportsIndex is the index containing user import jobs data.
	ImportsIndex opensearch.Index = "imports"
)

Variables

View Source
var CommonComponentTemplate = indices.NewComponentTemplateRequest("common",
	indices.WithIndexSettings(
		indices.WithMappings(CommonMappings),
		indices.WithAnalyzer(englishExactAnalyzer),
		indices.WithAnalyzer(personAnalyzer),
		indices.WithAnalyzer(htmlAnalyzer),
		indices.WithTokenizer(emailTokenizer),
		indices.WithNormalizer(lowercaseNormalizer),
	),
)

CommonComponentTemplate is a component template containing the common mappings.

View Source
var CommonMappings = indices.NewMappings(
	indices.WithMapping[opensearchapi.CommonMappingDateNanosProperty]("published"),
	indices.WithMapping[opensearchapi.CommonMappingDateNanosProperty]("updated"),
	indices.WithMapping("title",
		indices.WithTextMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
			indices.WithMapping("exact",
				indices.WithTextMappingAnalyzer(englishExactAnalyzer),
			),
			indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
		),
	),
	indices.WithMapping("description", indices.WithTextMappingAnalyzer(htmlAnalyzer)),
	indices.WithMapping("authors",
		indices.WithTextMappingAnalyzer(personAnalyzer),
		indices.WithTextMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
			indices.WithMapping("exact",
				indices.WithTextMappingAnalyzer(englishExactAnalyzer),
			),
			indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
		),
	),
	indices.WithMapping("contributors",
		indices.WithTextMappingAnalyzer(personAnalyzer),
		indices.WithTextMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
			indices.WithMapping("exact",
				indices.WithTextMappingAnalyzer(englishExactAnalyzer),
			),
			indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
		),
	),
	indices.WithMapping("categories",
		indices.WithTextMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
			indices.WithMapping("raw_nocase",
				indices.WithKeywordMappingNormalizer(lowercaseNormalizer),
			),
			indices.WithMapping("exact",
				indices.WithTextMappingAnalyzer(englishExactAnalyzer),
			),
			indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
		),
	),
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("language"),
	indices.WithMapping[opensearchapi.CommonMappingTextProperty]("copyright"),
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("source_type"),
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("url"),
	indices.WithMapping("image",
		indices.WithObjectMappingDynamic(opensearchapi.NewCommonMappingDynamicFromBool(false)),
		indices.WithObjectMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("url"),
			indices.WithMapping[opensearchapi.CommonMappingTextProperty]("title"),
		),
	),
)

CommonMappings are field mappings common across [models.Item] and [models.Feed].

View Source
var FeedsComponentTemplate = indices.NewComponentTemplateRequest(FeedsIndex.String(),
	indices.WithIndexSettings(
		indices.WithMappings(FeedsMappings),
		indices.WithAnalyzer(englishExactAnalyzer),
		indices.WithAnalyzer(domainNameAnalyzer),
		indices.WithTokenizer(domainTokenizer),
		indices.WithAnalyzer(htmlAnalyzer),
		indices.WithTokenizer(emailTokenizer),
	),
)

FeedsComponentTemplate is a component template containing [FeedMappings].

FeedsIndexTemplate is a index template for [models.Feed].

View Source
var FeedsMappings = indices.NewMappings(
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("feed_id"),
	indices.WithMapping[opensearchapi.CommonMappingDateNanosProperty]("created_at"),
	indices.WithMapping[opensearchapi.CommonMappingDateNanosProperty]("last_fetched"),
	indices.WithMapping[opensearchapi.CommonMappingUnsignedLongNumberProperty]("update_interval"),
	indices.WithMapping[opensearchapi.CommonMappingBooleanProperty]("updates_disabled"),
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("source_urls"),
	indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("fetch_method"),
	indices.WithMapping[opensearchapi.CommonMappingFlatObjectProperty]("fetch_options"),
	indices.WithMapping[opensearchapi.CommonMappingFlatObjectProperty]("quirks"),
	indices.WithMapping("domain",
		indices.WithTextMappingAnalyzer(domainNameAnalyzer),
		indices.WithTextMappingProperties(
			indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
			indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
		),
	),
	indices.WithMapping[opensearchapi.CommonMappingFlatObjectProperty]("source_data"),
	indices.WithMapping("customisation",
		indices.WithObjectMappingDynamic(opensearchapi.NewCommonMappingDynamicFromBool(false)),
		indices.WithObjectMappingProperties(
			indices.WithMapping("title",
				indices.WithTextMappingProperties(
					indices.WithMapping[opensearchapi.CommonMappingKeywordProperty]("raw"),
					indices.WithMapping("exact",
						indices.WithTextMappingAnalyzer(englishExactAnalyzer),
					),
					indices.WithMapping[opensearchapi.CommonMappingSearchAsYouTypeProperty]("search"),
				),
			),
			indices.WithMapping("description", indices.WithTextMappingAnalyzer(htmlAnalyzer)),
		),
	),
)

ItemsComponentTemplate is a component template containing [ItemMappings].

View Source
var ItemsISM = opensearchapi.ISMPolicy{
	ISMTemplate: new(opensearchapi.NewISMPolicyTemplateFromISMTemplate(
		opensearchapi.ISMTemplate{
			IndexPatterns: []string{ItemsIndex.String() + "-*"},
			Priority:      new(100.0),
		},
	)),
	States: []opensearchapi.ISMStates{
		{
			Name: new("hot"),
			Actions: []opensearchapi.ISMAction{
				{Rollover: &opensearchapi.ISMActionRollover{MinSize: new("10gb")}},
			},
			Transitions: []opensearchapi.ISMTransition{
				{StateName: new("merge")},
			},
		},
		{
			Name: new("merge"),
			Actions: []opensearchapi.ISMAction{
				{ForceMerge: &opensearchapi.ISMActionForceMerge{MaxNumSegments: new(1)}},
			},
		},
	},
}

ItemsIndexTemplate is a index template for [models.Item].

SchedulerComponentTemplate is a component template containing SchedulerMappings.

SchedulerIndexTemplate is a index template for [models.Feed].

SchedulerMappings is the field mappings for [models.Session].

SessionsComponentTemplate is a component template containing SchedulerMappings.

SessionsIndexTemplate is a index template for [models.Feed].

SessionsMappings is the field mappings for [models.Session].

Functions

func ItemsIngestPipeline added in v0.260.0

func ItemsIngestPipeline(modelID string) opensearchapi.IngestPutPipelineReq

ItemsIngestPipeline defines an ingest pipeline for processing [models.Item] before indexing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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