mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Fix some integer comparisons
This commit is contained in:
parent
7f125bfb12
commit
3ee7682fa7
@ -135,7 +135,7 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
|
|||||||
let del_vectors = extract_vectors(old, document_id, embedder_name)?;
|
let del_vectors = extract_vectors(old, document_id, embedder_name)?;
|
||||||
let add_vectors = extract_vectors(new, document_id, embedder_name)?;
|
let add_vectors = extract_vectors(new, document_id, embedder_name)?;
|
||||||
|
|
||||||
if add_vectors.len() > u8::MAX.into() {
|
if add_vectors.len() > usize::from(u8::MAX) {
|
||||||
return Err(crate::Error::UserError(crate::UserError::TooManyVectors(
|
return Err(crate::Error::UserError(crate::UserError::TooManyVectors(
|
||||||
document_id().to_string(),
|
document_id().to_string(),
|
||||||
add_vectors.len(),
|
add_vectors.len(),
|
||||||
@ -164,7 +164,7 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
|
|||||||
(None, Some(new)) => {
|
(None, Some(new)) => {
|
||||||
// was possibly autogenerated, remove all vectors for that document
|
// was possibly autogenerated, remove all vectors for that document
|
||||||
let add_vectors = extract_vectors(new, document_id, embedder_name)?;
|
let add_vectors = extract_vectors(new, document_id, embedder_name)?;
|
||||||
if add_vectors.len() > u8::MAX.into() {
|
if add_vectors.len() > usize::from(u8::MAX) {
|
||||||
return Err(crate::Error::UserError(crate::UserError::TooManyVectors(
|
return Err(crate::Error::UserError(crate::UserError::TooManyVectors(
|
||||||
document_id().to_string(),
|
document_id().to_string(),
|
||||||
add_vectors.len(),
|
add_vectors.len(),
|
||||||
|
@ -407,7 +407,7 @@ pub(crate) fn write_typed_chunk_into_index(
|
|||||||
// code error if we somehow got the wrong dimension
|
// code error if we somehow got the wrong dimension
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if embeddings.embedding_count() > u8::MAX.into() {
|
if embeddings.embedding_count() > usize::from(u8::MAX) {
|
||||||
let external_docid = if let Ok(Some(Ok(index))) = index
|
let external_docid = if let Ok(Some(Ok(index))) = index
|
||||||
.external_id_of(wtxn, std::iter::once(docid))
|
.external_id_of(wtxn, std::iter::once(docid))
|
||||||
.map(|it| it.into_iter().next())
|
.map(|it| it.into_iter().next())
|
||||||
|
Loading…
Reference in New Issue
Block a user