Skip to content

Conversation

@germanattanasio
Copy link
Contributor

@germanattanasio germanattanasio commented Sep 5, 2017

  • Generated code for discovery
  • Query method

This PR adds models for the various QueryAggregation types. Tests have been updated accordingly.

Mike Kistler and others added 8 commits August 13, 2017 08:22
@lpatino10 lpatino10 removed the request for review from maniax89 September 6, 2017 13:48
Copy link

@mkistler mkistler left a comment

Choose a reason for hiding this comment

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

Looks like there are still issues with consistent formatting. But other than that things all look good.

*/
public interface Status {
/** active. */
/**
Copy link

Choose a reason for hiding this comment

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

More funky reformatting. Did this come from the eclipse formatter?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think it did.

@codecov-io
Copy link

codecov-io commented Sep 7, 2017

Codecov Report

Merging #791 into develop will decrease coverage by 0.72%.
The diff coverage is 50.72%.

Impacted file tree graph

@@ Coverage Diff @@ ## develop #791 +/- ## ============================================ - Coverage 61.13% 60.4% -0.73%  - Complexity 2237 2321 +84  ============================================ Files 449 468 +19 Lines 10801 11464 +663 Branches 640 656 +16 ============================================ + Hits 6603 6925 +322  - Misses 3800 4131 +331  - Partials 398 408 +10
Impacted Files Coverage Δ Complexity Δ
...per_cloud/discovery/v1/model/DocumentAccepted.java 36.36% <ø> (ø) 3 <0> (ø) ⬇️
...eloper_cloud/discovery/v1/model/Configuration.java 57.89% <ø> (ø) 10 <0> (ø) ⬇️
...d/discovery/v1/model/ListEnvironmentsResponse.java 50% <ø> (ø) 2 <0> (ø) ⬇️
...eveloper_cloud/discovery/v1/model/FontSetting.java 5.26% <ø> (ø) 1 <0> (ø) ⬇️
...ud/discovery/v1/model/ListEnvironmentsOptions.java 69.23% <ø> (ø) 2 <0> (ø) ⬇️
...developer_cloud/discovery/v1/model/Enrichment.java 68.18% <ø> (ø) 8 <0> (ø) ⬇️
...loper_cloud/discovery/v1/model/DocumentCounts.java 25% <ø> (ø) 1 <0> (ø) ⬇️
...oud/discovery/v1/model/NormalizationOperation.java 81.81% <ø> (ø) 5 <0> (ø) ⬇️
...eveloper_cloud/discovery/v1/model/Conversions.java 30.76% <ø> (ø) 3 <0> (ø) ⬇️
...per_cloud/discovery/v1/model/DocumentSnapshot.java 25% <ø> (ø) 1 <0> (ø) ⬇️
... and 83 more

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 12b11b8...5589a78. Read the comment docs.

@germanattanasio
Copy link
Contributor Author

I think the last question we had before merging this was if the query request and response were being mapped to object or not.

@lpatino10
Copy link
Contributor

@germanattanasio I'm looking into that now and can add that into this PR when it's done.

@lpatino10
Copy link
Contributor

Here's an example of dealing with aggregations with the new changes:

QueryResponse queryResponse = discovery.query(queryOptions).execute(); Histogram histogram = (Histogram) queryResponse.getAggregations.get(0); Long interval = histogram.getInterval();

This should look the same as it did before we started using generated models. Does this look good @maniax89?

@maniax89
Copy link
Contributor

this looks great! that AggregationSerializer is pretty cool.

commentary - seems like a lot of the response classes have setters on them which i feel like they shouldn't, but maybe not the focus of this PR

@lpatino10
Copy link
Contributor

Thanks! And yeah we'll have to work together to update the models now that we have better support for this. Getting rid of the setters won't be difficult and I also know there are more aggregations to add in the future, for example.

@germanattanasio germanattanasio merged commit 2793eaf into develop Sep 14, 2017
Copy link

@mkistler mkistler left a comment

Choose a reason for hiding this comment

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

Looks very good. I made a few minor comments but nothing that should hold up this PR.

String TEXT_HTML = "text/html";
/** application/xhtml+xml. */
String APPLICATION_XHTML_XML = "application/xhtml+xml";
}

Choose a reason for hiding this comment

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

FYI ... the FileMediaType interface will go away with the changes I am making for file handling.

return this;
}

/**

Choose a reason for hiding this comment

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

sort is described in the API Ref as

a comma-separated list of fields in the document to sort on.

So an element of the sort array is a field.

It we want this to be reflected in the SDK, we just need to add an x-item-name annotation on sort with the value "field". Or maybe we would want sort_field. Then the comment above would read

Adds an sort_field to sort 

and the method signature below would be

public Builder addSortField(String sortField) { 
}

/**
* Adds an passagesFields to passagesFields.

Choose a reason for hiding this comment

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

This is another place where we might want to use x-item-name, probably just "passagesField".

* A query search returns all documents in your data set with full enrichments and full text, but with the most
* relevant documents listed first. Use a query search when you want to find the most relevant search results. You
* cannot use `natural_language_query` and `query` at the same time.
*

Choose a reason for hiding this comment

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

If we were writing this SDK by hand, we'd validate that natural_language_query and query are not both specified when constructing the options instance from the builder. There's no support for this in the generator today but we should consider adding it.

this.name = configuration.getName();
this.description = configuration.getDescription();
this.normalizations = configuration.getNormalizations();
this.enrichments = configuration.getEnrichments();

Choose a reason for hiding this comment

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

More funky formatting here. This case looks like some spacing issues in the template. But odd that it is showing up here and not in the other classes.

Choose a reason for hiding this comment

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

Oh ... I bet this is one of the "alternate-setters". Not in the template ... these lines are produced in the generator itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants