Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
- improved test coverage
- update README.md
  • Loading branch information
stevenferrer committed Feb 9, 2021
1 parent b025acf commit 845a6b9
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 239 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ SOLR ?="solr-go"

.PHONY: unit-test
unit-test:
go test -v -cover -race
go test -v -cover

.PHONY: integration-test
integration-test:
go test -tags integration -v -cover -race
go test -tags integration -v -cover

.PHONY: start-solr
start-solr: stop-solr
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@

A [Solr](https://lucene.apache.org/solr) client for [Go](https://golang.org/).

## Supported APIs

- [Collections API](https://lucene.apache.org/solr/guide/8_8/collections-api.html)
- [Query API](https://lucene.apache.org/solr/guide/8_8/json-request-api.html)
- [Facet API](https://lucene.apache.org/solr/guide/8_8/json-facet-api.html)
- [Update API](https://lucene.apache.org/solr/guide/8_8/uploading-data-with-index-handlers.html#uploading-data-with-index-handlers)
- [Schema API](https://lucene.apache.org/solr/guide/8_8/schema-api.html)
- [Config API](https://lucene.apache.org/solr/guide/8_8/config-api.html)
- [Suggester API](https://lucene.apache.org/solr/guide/8_8/suggester.html)

## Example

Please see [integration test](integration_test.go) for more examples.
See [integration test](integration_test.go) for more examples.

```go
// Create a client
Expand Down Expand Up @@ -59,7 +69,7 @@ queryResponse, err := client.Query(context.Background(), "techproducts", query)

## Contributing

All contributions are welcome!
Any contributions are welcome!

## License

Expand Down
1 change: 0 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type Client interface {
Query(ctx context.Context, collection string, query *Query) (*QueryResponse, error)

// Update can be used to add, update, or delete a document from the index.
// `body` is expected to contain the list of documents.
//
// Refer to https://lucene.apache.org/solr/guide/8_8/uploading-data-with-index-handlers.html
Update(ctx context.Context, collection string, ct ContentType, body io.Reader) (*UpdateResponse, error)
Expand Down
14 changes: 7 additions & 7 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ func (ct ComponentType) String() string {

// Component is a component
type Component struct {
// Type is the component type
ct ComponentType
name string
// ct is the component type
ct ComponentType
// name is the component name
name string
// class is the component class
class string
m M
// m is the component configurations
m M
}

// NewComponent returns a new Component
Expand Down Expand Up @@ -68,6 +71,3 @@ func (c *Component) BuildComponent() M {

return m
}

// UserProperty is a user property
type UserProperty struct{}
6 changes: 2 additions & 4 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import (

func TestBuildComponent(t *testing.T) {
got := solr.NewComponent(solr.SearchComponent).
Name("suggest").
Class("solr.SearchComponent").
Name("suggest").Class("solr.SearchComponent").
Config(solr.M{
"lookupImpl": "AnalyzingInfixLookupFactory",
"dictionaryImpl": "DocumentDictionaryFactory",
"field": "suggest",
"suggestAnalyzerFieldType": "suggext_text",
}).
BuildComponent()
}).BuildComponent()

expect := solr.M{
"name": "suggest",
Expand Down
Loading

0 comments on commit 845a6b9

Please sign in to comment.