forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Searching fully typed documents (Azure#51)
* make SearchResult use Document class instead of map for property bag * Search with fully typed documents
- Loading branch information
Showing
15 changed files
with
1,006 additions
and
2,612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
sdk/search/azure-search-data/src/test/java/com/azure/search/data/models/Bucket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.azure.search.data.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Objects; | ||
|
||
public class Bucket { | ||
|
||
@JsonProperty(value = "BucketName") | ||
public String bucketName; | ||
|
||
@JsonProperty(value = "Count") | ||
public int count; | ||
|
||
public Bucket bucketName(String bucketName) { | ||
this.bucketName = bucketName; | ||
return this; | ||
} | ||
|
||
public Bucket count(int count) { | ||
this.count = count; | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof Bucket)) return false; | ||
Bucket bucket = (Bucket) o; | ||
return count == bucket.count && | ||
Objects.equals(bucketName, bucket.bucketName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(bucketName, count); | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
...search/azure-search-data/src/test/java/com/azure/search/data/models/NonNullableModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package com.azure.search.data.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Arrays; | ||
import java.util.Date; | ||
import java.util.Objects; | ||
|
||
public class NonNullableModel { | ||
|
||
@JsonProperty(value = "Key") | ||
public String key; | ||
|
||
@JsonProperty(value = "Rating") | ||
public int rating; | ||
|
||
@JsonProperty(value = "Count") | ||
public long count; | ||
|
||
@JsonProperty(value = "IsEnabled") | ||
public boolean isEnabled; | ||
|
||
@JsonProperty(value = "Ratio") | ||
public double ratio; | ||
|
||
@JsonProperty(value = "StartDate") | ||
public Date startDate; | ||
|
||
@JsonProperty(value = "EndDate") | ||
public Date endDate; | ||
|
||
@JsonProperty(value = "TopLevelBucket") | ||
public Bucket topLevelBucket; | ||
|
||
@JsonProperty(value = "Buckets") | ||
public Bucket[] buckets; | ||
|
||
public NonNullableModel key(String key) { | ||
this.key = key; | ||
return this; | ||
} | ||
|
||
public NonNullableModel rating(int rating) { | ||
this.rating = rating; | ||
return this; | ||
} | ||
|
||
public NonNullableModel count(long count) { | ||
this.count = count; | ||
return this; | ||
} | ||
|
||
public NonNullableModel isEnabled(boolean enabled) { | ||
isEnabled = enabled; | ||
return this; | ||
} | ||
|
||
public NonNullableModel ratio(double ratio) { | ||
this.ratio = ratio; | ||
return this; | ||
} | ||
|
||
public NonNullableModel startDate(Date startDate) { | ||
this.startDate = startDate; | ||
return this; | ||
} | ||
|
||
public NonNullableModel endDate(Date endDate) { | ||
this.endDate = endDate; | ||
return this; | ||
} | ||
|
||
public NonNullableModel topLevelBucket(Bucket topLevelBucket) { | ||
this.topLevelBucket = topLevelBucket; | ||
return this; | ||
} | ||
|
||
public NonNullableModel buckets(Bucket[] buckets) { | ||
this.buckets = buckets; | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof NonNullableModel)) return false; | ||
NonNullableModel that = (NonNullableModel) o; | ||
return rating == that.rating && | ||
count == that.count && | ||
isEnabled == that.isEnabled && | ||
Double.compare(that.ratio, ratio) == 0 && | ||
key.equals(that.key) && | ||
((startDate == null && that.startDate == null) || (startDate.equals(that.startDate))) && | ||
((endDate == null && that.endDate == null) || (endDate.equals(that.endDate))) && | ||
((topLevelBucket == null && that.topLevelBucket == null) || (topLevelBucket.equals(that.topLevelBucket))) && | ||
Arrays.equals(buckets, that.buckets); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hash(key, rating, count, isEnabled, ratio, startDate, endDate, topLevelBucket); | ||
result = 31 * result + Arrays.hashCode(buckets); | ||
return result; | ||
} | ||
} |
Oops, something went wrong.