...
 
Commits (2)
    https://gitlab.dms3.io/is/go-idx-config/-/commit/dee79473a36825f1779c01aac7ecc98c35cacfde re-integrate with dms3 2021-09-21T14:51:47-04:00 tavit ohanian tavit@dms3.io https://gitlab.dms3.io/is/go-idx-config/-/commit/22a150ed55fd55c609f85c118ccd59ff49aa9ea4 Merge branch 'port-2021-09-01' 2021-09-21T14:54:47-04:00 tavit ohanian tavit@dms3.io
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 {
......