Documentation
¶
Index ¶
- type Indexer
- type IndexerOption
- func WithAlgoliaClient(a *algolia.Client) IndexerOption
- func WithBaseURL(b string) IndexerOption
- func WithDatabase(db *gorm.DB) IndexerOption
- func WithDocumentTypes(dts []*config.DocumentType) IndexerOption
- func WithDocumentsFolderID(d string) IndexerOption
- func WithDraftsFolderID(d string) IndexerOption
- func WithGoogleWorkspaceService(g *gw.Service) IndexerOption
- func WithLogger(l hclog.Logger) IndexerOption
- func WithMaxParallelDocuments(m int) IndexerOption
- func WithUpdateDocumentHeaders(u bool) IndexerOption
- func WithUpdateDraftHeaders(u bool) IndexerOption
- func WithUseDatabaseForDocumentData(u bool) IndexerOption
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
// DocumentTypes are a slice of document types from the application config.
DocumentTypes []*config.DocumentType
// 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
// UseDatabaseForDocumentData will use the database instead of Algolia as the
// source of truth for document data, if true.
UseDatabaseForDocumentData bool
}
Indexer contains the indexer configuration.
func NewIndexer ¶
func NewIndexer(opts ...IndexerOption) (*Indexer, error)
NewIndexer creates a new indexer.
type IndexerOption ¶
type IndexerOption func(*Indexer)
func WithAlgoliaClient ¶
func WithAlgoliaClient(a *algolia.Client) IndexerOption
WithAlgoliaClient sets the Algolia client.
func WithDocumentTypes ¶ added in v0.4.0
func WithDocumentTypes(dts []*config.DocumentType) IndexerOption
WithDocumentTypes sets the document types.
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 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.
func WithUseDatabaseForDocumentData ¶ added in v0.4.0
func WithUseDatabaseForDocumentData(u bool) IndexerOption
WithUseDatabaseForDocumentData sets the boolean to use the database for document data.