server

package
v0.0.0-...-0e4228c Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the version of the application
	Version string = "0.1.0"
)

Functions

func NewHTTPServer

func NewHTTPServer(pinta *PintaDBServer, port uint64)

NewHTTPServer creates a new HTTP server for PintaDB

Types

type Config

type Config struct {
	FullPath  string
	Dimension uint64
	HTTPPort  uint64
	GRPCPort  uint64
}

type PintaDBServer

type PintaDBServer struct {
	Documents []db.TextVec
	Config    Config
}

func NewServer

func NewServer(config Config) (*PintaDBServer, error)

NewServer creates a new PintaDB server The server is initialized with an empty database by default

func (*PintaDBServer) AddDocument

func (s *PintaDBServer) AddDocument(text string) error

AddDocument adds a new document to the database The document is indexed and vectorized before being added

func (*PintaDBServer) DBFile

func (s *PintaDBServer) DBFile() (*os.File, error)

DBFile returns the file object of the database

func (*PintaDBServer) LoadDB

func (s *PintaDBServer) LoadDB() error

LoadDB loads the database from the file

func (*PintaDBServer) Search

func (s *PintaDBServer) Search(text string, k int) ([]int, error)

Query returns the k most similar documents to the given text And the returned documents are sorted by similarity in descending order

Jump to

Keyboard shortcuts

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