Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #3

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4178159
Add New Facet Search Method - https://www.meilisearch.com/docs/refere…
migueltarga Jul 24, 2024
2310d3c
Fix ProcessingTimeMs case
migueltarga Jul 24, 2024
7a6746a
Add code-samples
migueltarga Jul 24, 2024
ccf656f
Update .code-samples.meilisearch.yaml
curquiza Jul 25, 2024
4211e24
Update .code-samples.meilisearch.yaml
curquiza Jul 25, 2024
8039c2f
Increase code coverage
migueltarga Jul 26, 2024
c4e85d6
fix linting
migueltarga Jul 26, 2024
2ee9dbf
Add rankingScoreThreshold search parameter
Ja7ad Jul 27, 2024
388f064
Fix add test ranking score threshold to index search
Ja7ad Jul 27, 2024
26be7c8
Merge #543
meili-bors[bot] Jul 29, 2024
142442f
Merge branch 'main' into feat/rankingScoreThreshold
curquiza Jul 29, 2024
f227f7b
fix: translated curl example to golang
Ja7ad Jul 29, 2024
7946372
fix: change index name example to books
Ja7ad Jul 29, 2024
81b4eaf
Fix allow typo tolerance to be disabled for an index
Ja7ad Jul 30, 2024
9691a73
Update .code-samples.meilisearch.yaml
curquiza Jul 30, 2024
020572d
Merge #544
meili-bors[bot] Jul 30, 2024
634600f
Merge #545
meili-bors[bot] Jul 30, 2024
966203d
Update version.go
meili-bot Jul 30, 2024
59cdcef
Merge #546
meili-bors[bot] Jul 30, 2024
b52fd49
Feat supported searchCutoffMs setting
Ja7ad Jul 31, 2024
c3f14b3
fix: add search cut off ms to index interface
Ja7ad Jul 31, 2024
522f179
Feat accept distinct search parameter
Ja7ad Jul 31, 2024
e573b98
Merge branch 'main' into feat/searchCutoffMs
Ja7ad Jul 31, 2024
3459ce4
Merge branch 'main' into feat/distinct
Ja7ad Jul 31, 2024
2e63faa
Merge #548
meili-bors[bot] Jul 31, 2024
ed238cb
Merge branch 'main' into feat/searchCutoffMs
Ja7ad Jul 31, 2024
8b4382e
fix: add searchCutoffMs in code sample and update settings
Ja7ad Jul 31, 2024
f792ff5
Feat get similar documents
Ja7ad Jul 31, 2024
69d3542
Merge #547
meili-bors[bot] Jul 31, 2024
634bb76
Merge branch 'main' into feat/similar-documents
Ja7ad Jul 31, 2024
726e14a
Fix add json tag on search request
Ja7ad Aug 1, 2024
869e743
Merge #549
meili-bors[bot] Aug 1, 2024
1a59b95
Merge branch 'main' into fix/json-tag-search-req
Ja7ad Aug 1, 2024
52de46a
fix: conflicts on new changes
Ja7ad Aug 1, 2024
c9e06f8
fix: improve test coverage in index_search
Ja7ad Aug 1, 2024
a60bb2d
fix: add test for types methods
Ja7ad Aug 1, 2024
8e19813
docs: add package documentation
Ja7ad Aug 4, 2024
2544334
fix: refactor fasthttp client to http client
Ja7ad Aug 4, 2024
6859a7f
chore: add general errors
Ja7ad Aug 4, 2024
9ed1483
feat: add option pattern for make optional client
Ja7ad Aug 4, 2024
96e9a18
docs: update documentation of types
Ja7ad Aug 4, 2024
bb59fa3
chore: add example test for function New and Connect
Ja7ad Aug 4, 2024
794b6ad
docs: update readme for new meilisearch
Ja7ad Aug 4, 2024
b94d7f1
chore: add helper function with test
Ja7ad Aug 4, 2024
af7e8b8
feat: add service manager to manage index, key, task and other operation
Ja7ad Aug 4, 2024
ded6cec
feat: add index manager to manage index and search
Ja7ad Aug 4, 2024
f526c9a
fix: update module version to 1.17 for fix issue testify
Ja7ad Aug 4, 2024
67c39c8
fix: update go module
Ja7ad Aug 4, 2024
3daaca6
fix: change testify version to stable and support go 1.16
Ja7ad Aug 4, 2024
621feaf
docs: update example documentation
Ja7ad Aug 4, 2024
2afede6
chore: update many for coverage
Ja7ad Aug 4, 2024
ea75d08
fix: improved coverage test of client
Ja7ad Aug 4, 2024
f059542
fix: client test except on pool
Ja7ad Aug 4, 2024
a1e7862
fix: change old client example to new
Ja7ad Aug 7, 2024
a023417
fix: add test for RawType to improve coverage
Ja7ad Aug 12, 2024
cb933a8
fix: add update documents test for improve coverage
Ja7ad Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 57 additions & 40 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ multi_search_1: |-
},
},
})
facet_search_1: |-
client.Index("books").FacetSearch(&meilisearch.FacetSearchRequest{
FacetQuery: "fiction",
FacetName: "genres",
Filter: "rating > 3",
})
facet_search_3: |-
client.Index("books").FacetSearch(&meilisearch.FacetSearchRequest{
FacetQuery: "c",
FacetName: "genres",
})
delete_tasks_1: |-
client.DeleteTaks(&meilisearch.DeleteTasksQuery{
UIDS: []int64{1, 2},
Expand Down Expand Up @@ -236,6 +247,7 @@ update_settings_1: |-
Faceting: &meilisearch.Faceting{
MaxValuesPerFacet: 200,
},
SearchCutoffMs: 150,
}
client.Index("movies").UpdateSettings(&settings)
reset_settings_1: |-
Expand Down Expand Up @@ -503,10 +515,7 @@ add_movies_json_1: |-

client.Index("movies").AddDocuments(&movies)
landing_getting_started_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))

documents := []map[string]interface{}{
{ "id": 1, "title": "Carol" },
Expand Down Expand Up @@ -536,10 +545,7 @@ getting_started_add_documents_md: |-
)

func main() {
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: aSampleMasterKey,
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))

jsonFile, _ := os.Open("movies.json")
defer jsonFile.Close()
Expand All @@ -564,9 +570,7 @@ getting_started_search_md: |-

[About this SDK](https://github.com/meilisearch/meilisearch-go/)
getting_started_add_meteorites: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
})
client := meilisearch.New("http://localhost:7700")

jsonFile, _ := os.Open("meteorites.json")
defer jsonFile.Close()
Expand Down Expand Up @@ -645,7 +649,11 @@ getting_started_configure_settings: |-
getting_started_faceting: |-
client.Index("movies").UpdateFaceting(&meilisearch.Faceting{
MaxValuesPerFacet: 2,
SortFacetValuesBy: {
"*": "count"
}
})

getting_started_pagination: |-
client.Index("movies").UpdatePagination(&meilisearch.Pagination{
MaxTotalHits: 500,
Expand Down Expand Up @@ -775,25 +783,16 @@ primary_field_guide_add_document_primary_key: |-
primary_field_guide_update_document_primary_key: |-
client.Index("books").UpdateIndex("title")
security_guide_search_key_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "apiKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))
client.Index("patient_medical_records").Search();
security_guide_update_key_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))

client.UpdateKey("74c9c733-3368-4738-bbe5-1d18a5fecb37", &meilisearch.Key{
Indexes: []string{"doctors"},
})
security_guide_create_key_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))

client.CreateKey(&meilisearch.Key{
Description: "Search patient records key",
Expand All @@ -802,22 +801,13 @@ security_guide_create_key_1: |-
ExpiresAt: time.Date(2042, time.April, 02, 0, 42, 42, 0, time.UTC),
})
security_guide_list_keys_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))
client.GetKeys(nil);
security_guide_delete_key_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))
client.DeleteKey("74c9c733-3368-4738-bbe5-1d18a5fecb37");
authorization_header_1: |-
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))
client.GetKeys(nil);
tenant_token_guide_generate_sdk_1: |-
searchRules := map[string]interface{}{
Expand All @@ -832,11 +822,8 @@ tenant_token_guide_generate_sdk_1: |-

token, err := client.GenerateTenantToken(searchRules, options);
tenant_token_guide_search_sdk_1: |-
frontEndClient := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://localhost:7700",
APIKey: token,
})
frontEndClient.Index("patient_medical_records").Search("blood test", &meilisearch.SearchRequest{});
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("masterKey"))
client.Index("patient_medical_records").Search("blood test", &meilisearch.SearchRequest{});
synonyms_guide_1: |-
synonyms := map[string][]string{
"great": []string{"fantastic"},
Expand Down Expand Up @@ -868,3 +855,33 @@ date_guide_sort_1: |-
"release_timestamp:desc",
},
})
search_parameter_reference_distinct_1: |-
client.Index("INDEX_NAME").Search("QUERY TERMS", &meilisearch.SearchRequest{
Distinct: "ATTRIBUTE_A",
})
distinct_attribute_guide_distinct_parameter_1: |-
client.Index("products").Search("white shirt", &meilisearch.SearchRequest{
Distinct: "sku",
})
distinct_attribute_guide_filterable_1: |-
filterableAttributes := []string{
"product_id",
"sku",
"url",
}
client.Index("products").UpdateFilterableAttributes(&filterableAttributes)
get_similar_post_1: |-
resp := new(meilisearch.SimilarDocumentResult)
client.Index("INDEX_NAME").SearchSimilarDocuments(&meilisearch.SimilarDocumentQuery{
Id: "TARGET_DOCUMENT_ID",
}, resp)
search_parameter_reference_ranking_score_threshold_1: |-
client.Index("INDEX_NAME").Search("badman", &meilisearch.SearchRequest{
RankingScoreThreshold: 0.2,
})
get_search_cutoff_1: |-
client.Index("movies").GetSearchCutoffMs()
update_search_cutoff_1: |-
client.Index("movies").UpdateSearchCutoffMs(150)
reset_search_cutoff_1: |-
client.Index("books").ResetSearchCutoffMs()
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ import (
)

func main() {
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://127.0.0.1:7700",
APIKey: "masterKey",
})
client := meilisearch.New("http://localhost:7700", meilisearch.WithAPIKey("foobar"))

// An index is where the documents are stored.
index := client.Index("movies")

Expand Down
Loading
Loading