Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
is
go-idx-config
Commits
dee79473
Commit
dee79473
authored
Sep 21, 2021
by
tavit ohanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-integrate with dms3
parent
1d3cd1d9
Pipeline
#1356
passed with stages
in 32 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
33 deletions
+35
-33
.gitignore
.gitignore
+1
-0
config.go
config.go
+1
-1
init.go
init.go
+27
-27
serialize/serialize.go
serialize/serialize.go
+1
-1
serialize/serialize_test.go
serialize/serialize_test.go
+5
-4
No files found.
.gitignore
View file @
dee79473
cid-fuzz.zip
.dms3config
config.go
View file @
dee79473
...
...
@@ -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
...
...
init.go
View file @
dee79473
...
...
@@ -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,
},
...
...
serialize/serialize.go
View file @
dee79473
package
idx
repo
package
idx
serialize
import
(
"encoding/json"
...
...
serialize/serialize_test.go
View file @
dee79473
package
idx
repo
package
idx
serialize
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 {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment