package
1.0.51
Repository: https://github.com/mutablelogic/go-sqlite.git
Documentation: pkg.go.dev

# README

sqlite3 file indexer

This package provides a file indexer, which indexes files in one or more folders (and their child folders) in an sqlite3 database, and can update when files and folders are added, changed and deleted.

This package is part of a wider project, github.com/mutablelogic/go-sqlite. Please see the module documentation for more information.

Introduction

An indexing process consists of:

  1. In Indexer object, which runs the indexing process;
  2. A Queue object, which receives change events from the indexer and passes them onto the storage;
  3. A Store object, which consumes change events and maintains the database.

To create an indexer, use the NewIndexer function. Pass the unique name for the index, the path to the folder to index, and a Queue object. For example,

package main

import (
	// Packages
	"github.com/mutablelogic/go-sqlite/pkg/indexer"
)

func main() {
    name, path := // ....

    // Create a queue and indexer
    queue := indexer.NewQueue()
	indexer, err := indexer.NewIndexer(name, path, queue)
	if err != nil {
        panic(err)
	}

    // Perform indexing in background process...
    var wg sync.WaitGroup
    go Index(&wg, indexer)
    go Walk(&wg, indexer)
    go Process(&wg, queue)
   
	// Wait for all goroutines to finish
	wg.Wait()

    // Do any cleanup here
}

The three background goroutines are:

  1. Index: Watches for changes to the folder and indexes the files;
  2. Walk: Performs a recursive walk of the folder and indexes the files;
  3. Process: Consumes change events from the queue and updates the database.

Consuming change events

TODO

File and path inclusions and exclusions

TODO

Example Applications

There is an example application here which will index a folder into an sqlite database, and a plugin for go-server here which provides a REST API to the indexing process. You may want to build your own application to index your files, in which case read on.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
Get indexes and count of documents for each index.
Create a new indexer with an identifier, path to the root of the indexer and a queue.
Create a new queue with default capacity.
Create a new queue which acts as a buffer between the file indexing and the processng/rendering which can be slower than the file indexing.
Create a new store object.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Search virtual table uses View to get content.
No description provided by the author
View is used as the content source for the search virtual table and is a join between File and Doc.

# Type aliases

No description provided by the author
No description provided by the author
WalkFunc is called after a reindexing with any walk errors.