@@ -93,7 +93,7 @@ public class SearchResultsItem<T> {
9393 private Boolean automaticInsights ;
9494
9595 @ JsonProperty ("hits" )
96- private List <T > hits = new ArrayList <>() ;
96+ private List <T > hits ;
9797
9898 @ JsonProperty ("hitsPerPage" )
9999 private Integer hitsPerPage ;
@@ -467,6 +467,9 @@ public SearchResultsItem<T> setHits(List<T> hits) {
467467 }
468468
469469 public SearchResultsItem <T > addHits (T hitsItem ) {
470+ if (this .hits == null ) {
471+ this .hits = new ArrayList <>();
472+ }
470473 this .hits .add (hitsItem );
471474 return this ;
472475 }
@@ -475,7 +478,7 @@ public SearchResultsItem<T> addHits(T hitsItem) {
475478 * Search results (hits). Hits are records from your index that match the search criteria,
476479 * augmented with additional attributes, such as, for highlighting.
477480 */
478- @ javax .annotation .Nonnull
481+ @ javax .annotation .Nullable
479482 public List <T > getHits () {
480483 return hits ;
481484 }
@@ -486,7 +489,7 @@ public SearchResultsItem<T> setHitsPerPage(Integer hitsPerPage) {
486489 }
487490
488491 /** Number of hits returned per page. */
489- @ javax .annotation .Nonnull
492+ @ javax .annotation .Nullable
490493 public Integer getHitsPerPage () {
491494 return hitsPerPage ;
492495 }
@@ -497,7 +500,7 @@ public SearchResultsItem<T> setNbHits(Integer nbHits) {
497500 }
498501
499502 /** Number of results (hits). */
500- @ javax .annotation .Nonnull
503+ @ javax .annotation .Nullable
501504 public Integer getNbHits () {
502505 return nbHits ;
503506 }
@@ -508,7 +511,7 @@ public SearchResultsItem<T> setNbPages(Integer nbPages) {
508511 }
509512
510513 /** Number of pages of results. */
511- @ javax .annotation .Nonnull
514+ @ javax .annotation .Nullable
512515 public Integer getNbPages () {
513516 return nbPages ;
514517 }
@@ -519,7 +522,7 @@ public SearchResultsItem<T> setPage(Integer page) {
519522 }
520523
521524 /** The current page of the results. */
522- @ javax .annotation .Nonnull
525+ @ javax .annotation .Nullable
523526 public Integer getPage () {
524527 return page ;
525528 }
@@ -530,7 +533,7 @@ public SearchResultsItem<T> setParams(String params) {
530533 }
531534
532535 /** URL-encoded string of all search parameters. */
533- @ javax .annotation .Nonnull
536+ @ javax .annotation .Nullable
534537 public String getParams () {
535538 return params ;
536539 }
@@ -541,7 +544,7 @@ public SearchResultsItem<T> setQuery(String query) {
541544 }
542545
543546 /** The search query string. */
544- @ javax .annotation .Nonnull
547+ @ javax .annotation .Nullable
545548 public String getQuery () {
546549 return query ;
547550 }
0 commit comments