@@ -71,7 +71,7 @@ public class Document implements MediaContent {
7171	 * measure. 
7272	 */ 
7373	@ Nullable 
74- 	private  Double  score ;
74+ 	private  final   Double  score ;
7575
7676	/** 
7777	 * Embedding of the document. Note: ephemeral field. 
@@ -90,10 +90,6 @@ public Document(@JsonProperty("content") String content) {
9090		this (content , new  HashMap <>());
9191	}
9292
93- 	/** 
94- 	 * @deprecated Use builder instead: {@link Document#builder()}. 
95- 	 */ 
96- 	@ Deprecated (since  = "1.0.0-M5" , forRemoval  = true )
9793	public  Document (String  content , Map <String , Object > metadata ) {
9894		this (content , metadata , new  RandomIdGenerator ());
9995	}
@@ -114,10 +110,6 @@ public Document(String content, Map<String, Object> metadata, IdGenerator idGene
114110		this (idGenerator .generateId (content , metadata ), content , metadata );
115111	}
116112
117- 	/** 
118- 	 * @deprecated Use builder instead: {@link Document#builder()}. 
119- 	 */ 
120- 	@ Deprecated (since  = "1.0.0-M5" , forRemoval  = true )
121113	public  Document (String  id , String  content , Map <String , Object > metadata ) {
122114		this (id , content , List .of (), metadata );
123115	}
@@ -194,10 +186,6 @@ public Double getScore() {
194186		return  this .score ;
195187	}
196188
197- 	public  void  setScore (@ Nullable  Double  score ) {
198- 		this .score  = score ;
199- 	}
200- 
201189	/** 
202190	 * Return the embedding that were calculated. 
203191	 * @deprecated We are considering getting rid of this, please comment on 
@@ -233,20 +221,27 @@ public void setContentFormatter(ContentFormatter contentFormatter) {
233221		this .contentFormatter  = contentFormatter ;
234222	}
235223
236- 	@ Override 
237- 	public  int  hashCode () {
238- 		return  Objects .hash (id , content , media , metadata );
224+ 	public  Builder  mutate () {
225+ 		return  new  Builder ().id (this .id )
226+ 			.content (this .content )
227+ 			.media (new  ArrayList <>(this .media ))
228+ 			.metadata (this .metadata )
229+ 			.score (this .score );
239230	}
240231
241232	@ Override 
242233	public  boolean  equals (Object  o ) {
243- 		if  (this  == o )
244- 			return  true ;
245234		if  (o  == null  || getClass () != o .getClass ())
246235			return  false ;
247236		Document  document  = (Document ) o ;
248237		return  Objects .equals (id , document .id ) && Objects .equals (content , document .content )
249- 				&& Objects .equals (media , document .media ) && Objects .equals (metadata , document .metadata );
238+ 				&& Objects .equals (media , document .media ) && Objects .equals (metadata , document .metadata )
239+ 				&& Objects .equals (score , document .score );
240+ 	}
241+ 
242+ 	@ Override 
243+ 	public  int  hashCode () {
244+ 		return  Objects .hash (id , content , media , metadata , score );
250245	}
251246
252247	@ Override 
@@ -267,6 +262,7 @@ public static class Builder {
267262
268263		private  float [] embedding  = new  float [0 ];
269264
265+ 		@ Nullable 
270266		private  Double  score ;
271267
272268		private  IdGenerator  idGenerator  = new  RandomIdGenerator ();
@@ -314,7 +310,7 @@ public Builder embedding(float[] embedding) {
314310			return  this ;
315311		}
316312
317- 		public  Builder  score (Double  score ) {
313+ 		public  Builder  score (@ Nullable   Double  score ) {
318314			this .score  = score ;
319315			return  this ;
320316		}
0 commit comments