func()

in internal/zoekt/zoekt.go [75:97]


func (c *Client) AddFile(builder *index.Builder, path string, content []byte, size int64, tooLarge bool, branches []string) error {
	if tooLarge && !c.builderOptions.IgnoreSizeMax(path) {
		if err := builder.Add(index.Document{
			SkipReason: index.SkipReasonTooLarge,
			Name:       path,
			Branches:   branches,
		}); err != nil {
			return err
		}

		return nil
	}

	if err := builder.Add(index.Document{
		Name:     path,
		Content:  content,
		Branches: branches,
	}); err != nil {
		return fmt.Errorf("error adding document with name %s: %w", path, err)
	}

	return nil
}