Commit 22a150ed authored by tavit ohanian's avatar tavit ohanian

Merge branch 'port-2021-09-01'

parents 4e8adf61 dee79473
Pipeline #1358 passed with stages
in 6 seconds
cid-fuzz.zip
.dms3config
......@@ -21,7 +21,7 @@ type IdxConfig struct {
const (
// DefaultPathName is the default idxconfig dir name
DefaultPathName = ".dms3-fs/index"
DefaultPathName = ".dms3/index"
// DefaultPathRoot is the path to the default idxconfig dir location.
DefaultPathRoot = "~/" + DefaultPathName
// DefaultIdxConfigFile is the filename of the configuration file
......
......@@ -6,53 +6,53 @@ import (
//"fmt"
"io"
//"time"
// config "gitlab.dms3.io/dms3/go-dms3-config"
)
func Init(out io.Writer) (*IdxConfig, error) {
//datastore := DefaultDatastoreConfig()
// datastore := config.DefaultDatastoreConfig()
iconf := &IdxConfig{
Indexer: Indexer{
Path: "", // path to index, ex: repo/base
Memory: "100M",
Stemmer: "krovetz",
Normalize: true,
Stopper: []string{
Path: "", // path to index, ex: repo/base
Memory: "100M",
Stemmer: "krovetz",
Normalize: true,
Stopper: []string{
"a",
"an",
"the",
"as",
},
Corpus: Corpus{
Path: "", // path to repository, ex: repo/base/corpus
Class: "html",
Corpus: Corpus{
Path: "", // path to repository, ex: repo/base/corpus
Class: "html",
},
MaxDocs: "100M", // max # of doc per index
MaxDocs: "100M", // max # of doc per index
},
Metadata: Metadata{
Kind: []Kind{{
Kind: []Kind{{
Name: "blog",
Field: []string{
"About",
"Address",
"Affiliation",
"Author",
"Brand",
"Citation",
"Description",
"Email",
"Headline",
"Keywords",
"Language",
"Name",
"Telephone",
"Version",
},
"Address",
"Affiliation",
"Author",
"Brand",
"Citation",
"Description",
"Email",
"Headline",
"Keywords",
"Language",
"Name",
"Telephone",
"Version",
},
},
},
},
},
Retriever: Retriever{
MaxResultCount: 100,
},
......
package idxrepo
package idxserialize
import (
"encoding/json"
......
package idxrepo
package idxserialize
import (
// "fmt"
"os"
"runtime"
"testing"
......@@ -11,7 +12,6 @@ import (
func TestConfig(t *testing.T) {
const filename = ".dms3config"
cfgWritten := new(idxconfig.IdxConfig)
cfgWritten.Identity.PeerID = "faketest"
err := WriteConfigFile(filename, cfgWritten)
if err != nil {
......@@ -21,8 +21,9 @@ func TestConfig(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if cfgWritten.Identity.PeerID != cfgRead.Identity.PeerID {
t.Fatal()
// fmt.Printf("Metadata: %v\n", cfgRead.Metadata)
if len(cfgWritten.Metadata.Kind) != len(cfgRead.Metadata.Kind) {
t.Fatalf("field name read: %v, does not match written: %v", cfgRead.Metadata, cfgWritten.Metadata)
}
st, err := os.Stat(filename)
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment