Skip to content

Conversation

ishanarya0
Copy link
Member

Command:
$ stencil search <query> --namespace=<namespace> --schema=<schema> --version=<version> --history=<history>

Set either of version or history flags. Version flag is used to search on a particular version while history flag enables the user to search across all the versions.

@ishanarya0 ishanarya0 requested a review from ravisuhag February 20, 2022 06:37
@ishanarya0 ishanarya0 added the enhancement New feature or request label Feb 20, 2022
@ishanarya0 ishanarya0 linked an issue Feb 21, 2022 that may be closed by this pull request
@ishanarya0 ishanarya0 removed a link to an issue Feb 21, 2022
}
defer conn.Close()

query := args[0]
Copy link
Member

Choose a reason for hiding this comment

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

add check for args length. Otherwise it will panic if search query not given.

cmd/search.go Outdated
strconv.Itoa(i + 1),
h.GetNamespaceId(),
h.GetSchemaId(),
strings.Join(h.GetFields(), ","),
Copy link
Member

Choose a reason for hiding this comment

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

Output of search results are unreadable if more number of matching field names or messages present. Maybe we can print each field/type name in separate row to make it more user friendly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right! How about this @harikrishnakanchi?

Also, I am thinking of removing the "NAMESPACE" and "SCHEMA" details as well, since their values will be the same as the user passed in flags.

Showing 2 result(s) 
                                                      
1)                                                    
FIELD: stencil.One.field_one                          
TYPE: stencil.One                                     
VERSION: 1                                            
                                                      
2)                                                    
FIELD: stencil.One.field_one,stencil.One.Two.field_two
TYPE: stencil.One,stencil.One.Two                     
VERSION: 2                                            
     
TOTAL
2

Copy link
Member

Choose a reason for hiding this comment

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

something like this should be good.

Namespace Schema version Type Fields
org schema-name 1 odpf.stencil.One odpf.stencil.One.field_one, odpf.stencil.One.field_one

With this we need to group fields by type name. Currently it just returns all matching fields and all matching type. Fields can be segregated by type then show it.

@ishanarya0 ishanarya0 requested a review from h4rikris February 21, 2022 06:49
@ishanarya0
Copy link
Member Author

ishanarya0 commented Feb 21, 2022

This is how this will look now. WDYT about it?

Showing 3 versions 
NAMESPACE       SCHEMA  VERSION TYPES           FIELDS                          
mynamespace     abc     3       stencil.A.Z     field_z                         
.
.                      
mynamespace     abc     3       stencil.D.Z     field_z                         
                                                                                
mynamespace     abc     4       stencil.A.Z     field_z                         
.
.
.
.                       
mynamespace     abc     4       stencil.D.Z     field_z                         
                                                                                
mynamespace     abc     5       stencil.A.Z     field_z, field_z_z          
mynamespace     abc     5       stencil.A.Y     field_z, field_z_z, field_z_z_z
.
.
.                        
mynamespace     abc     5       stencil.D.Z     field_z                         
                                                                                
TOTAL:  16

Shall we remove the NAMESPACE and SCHEMA columns, since it will be a piece of redundant information (same as flag value)? @harikrishnakanchi

@ravisuhag
Copy link
Member

ravisuhag commented Feb 22, 2022

@ishanarya0 lets keep them. Also specifying namespace and schema should also be optional. User should be able to search across schemas. Does API support that right now?

@ishanarya0
Copy link
Member Author

@ishanarya0 lets keep them. Also specifying namespace and schema should also be optional. User should be able to search across schemas. Does API support that right now?

Yes, keeping them. Oh, yes they can be made optional too. Doing the changes. Thanks for pointing it out!

@ravisuhag ravisuhag merged commit 01301c4 into master Feb 22, 2022
@ravisuhag ravisuhag deleted the search-cmd branch February 22, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants