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
Compare Revisions
4e8adf616667199120fffe2acd38d76d938cd65e...22a150ed55fd55c609f85c118ccd59ff49aa9ea4
Source
22a150ed55fd55c609f85c118ccd59ff49aa9ea4
Select Git revision
...
Target
4e8adf616667199120fffe2acd38d76d938cd65e
Select Git revision
Compare
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
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 @
22a150ed
cid-fuzz.zip
.dms3config
config.go
View file @
22a150ed
...
...
@@ -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 @
22a150ed
...
...
@@ -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 @
22a150ed
package
idx
repo
package
idx
serialize
import
(
"encoding/json"
...
...
serialize/serialize_test.go
View file @
22a150ed
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
{
...
...