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

Add support for searching by group #243

Merged
merged 3 commits into from
Feb 24, 2020
Merged

Add support for searching by group #243

merged 3 commits into from
Feb 24, 2020

Conversation

rowanseymour
Copy link
Contributor

@rowanseymour rowanseymour commented Feb 21, 2020

Pausing to go learn ES..

// }
type parseResponse struct {
Query string `json:"query"`
Fields []string `json:"fields"`
ElasticQuery interface{} `json:"elastic_query"`
AllowAsGroup bool `json:"allow_as_group"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we shouldn't trust RP on this.. and maybe even push this decision down to goflow

@@ -28,11 +28,11 @@
"path": "/mr/contact/parse_query",
"body": {
"org_id": 1,
"query": "age \u003e 10"
"query": "AGE>10"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure we're sending back a rewritten query

@codecov
Copy link

codecov bot commented Feb 21, 2020

Codecov Report

Merging #243 into master will decrease coverage by 0.04%.
The diff coverage is 88.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
- Coverage   48.08%   48.04%   -0.05%     
==========================================
  Files          83       83              
  Lines        7603     7608       +5     
==========================================
- Hits         3656     3655       -1     
- Misses       3368     3371       +3     
- Partials      579      582       +3
Impacted Files Coverage Δ
web/contact/contact.go 65% <100%> (+0.59%) ⬆️
models/contacts.go 47.42% <72.72%> (-0.45%) ⬇️
search/search.go 86.78% <90%> (-1.65%) ⬇️
models/assets.go 49.44% <0%> (-0.74%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8793007...3aea28e. Read the comment docs.

search/search.go Outdated
@@ -14,6 +14,9 @@ import (
"github.com/shopspring/decimal"
)

// GroupResolverFunc resolves a group name to a UUID because ES indexes groups by the latter
type GroupResolverFunc func(name string) assets.Group
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about having a single interface that has a ResolveField and ResolveGroup function on it? Just seems we are building lots of anonymous functions to represent something instead of just having an interface that would be clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine but note that you can't use an interface - golang doesn't let you implement an interface anonymously 😐

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand. Yes, we'd need to create a struct, but then OrgAssets could just satisfy that as would a test version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I'm doing - just meant you need a struct.. can't just define the funcs on the fly like we're doing currently

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, well I don't much love on the fly funcs anyways so that's fine by me!

Copy link
Member

@nicpottier nicpottier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should work! I would REALLY like to see an interface for resolving things instead of passing in two functions though.

@rowanseymour
Copy link
Contributor Author

@nicpottier wanna take another peek?

@rowanseymour rowanseymour changed the title Add support for searching by group (WIP) Add support for searching by group Feb 24, 2020
@rowanseymour rowanseymour merged commit 0dbf670 into master Feb 24, 2020
@rowanseymour rowanseymour deleted the latest_goflow branch February 24, 2020 20:38
rasoro pushed a commit to Ilhasoft/mailroom that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants