indexer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer

type Indexer struct {
	// AlgoliaClient is the Algolia client.
	AlgoliaClient *algolia.Client

	// BaseURL is the base URL for the application.
	BaseURL string

	// Database is the database connection.
	Database *gorm.DB

	// DocumentsFolderID is the Google Drive ID of the folder containing published
	// documents to index.
	DocumentsFolderID string

	// DraftsFolderID is the Google Drive ID of the folder containing draft
	// documents to index.
	DraftsFolderID string

	// GoogleWorkspaceService is the Google Workspace service.
	GoogleWorkspaceService *gw.Service

	// Logger is the logger to use.
	Logger hclog.Logger

	// MaxParallelDocuments is the maximum number of documents that will be
	// simultaneously indexed.
	MaxParallelDocuments int

	// UpdateDocumentHeaders updates published document headers, if true.
	UpdateDocumentHeaders bool

	// UpdateDraftHeaders updates draft document headers, if true.
	UpdateDraftHeaders bool
}

Indexer contains the indexer configuration.

func NewIndexer

func NewIndexer(opts ...IndexerOption) (*Indexer, error)

NewIndexer creates a new indexer.

func (*Indexer) Run

func (idx *Indexer) Run() error

Run runs the indexer. TODO: improve error handling.

type IndexerOption

type IndexerOption func(*Indexer)

func WithAlgoliaClient

func WithAlgoliaClient(a *algolia.Client) IndexerOption

WithAlgoliaClient sets the Algolia client.

func WithBaseURL

func WithBaseURL(b string) IndexerOption

WithBaseURL sets the base URL.

func WithDatabase

func WithDatabase(db *gorm.DB) IndexerOption

WithDatabase sets the database.

func WithDocumentsFolderID

func WithDocumentsFolderID(d string) IndexerOption

WithDocumentsFolderID sets the documents folder ID.

func WithDraftsFolderID

func WithDraftsFolderID(d string) IndexerOption

WithDraftsFolderID sets the drafts folder ID.

func WithGoogleWorkspaceService

func WithGoogleWorkspaceService(g *gw.Service) IndexerOption

WithGoogleWorkspaceService sets the Google Workspace service.

func WithLogger

func WithLogger(l hclog.Logger) IndexerOption

WithLogger sets the logger.

func WithMaxParallelDocuments

func WithMaxParallelDocuments(m int) IndexerOption

WithMaxParallelDocuments sets the number of documents (per folder) to index in parallel.

func WithUpdateDocumentHeaders

func WithUpdateDocumentHeaders(u bool) IndexerOption

WithUpdateDocumentHeaders sets the boolean to update draft document headers.

func WithUpdateDraftHeaders

func WithUpdateDraftHeaders(u bool) IndexerOption

WithUpdateDraftHeaders sets the boolean to update draft document headers.

Jump to

Keyboard shortcuts

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