mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 16:06:31 +00:00 
			
		
		
		
	Introduce the new invalid sortable error codes
This commit is contained in:
		
							
								
								
									
										17
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @@ -1585,7 +1585,6 @@ dependencies = [ | |||||||
|  "fst", |  "fst", | ||||||
|  "futures", |  "futures", | ||||||
|  "futures-util", |  "futures-util", | ||||||
|  "grenad", |  | ||||||
|  "heed", |  "heed", | ||||||
|  "hex", |  "hex", | ||||||
|  "http", |  "http", | ||||||
| @@ -1676,8 +1675,8 @@ dependencies = [ | |||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "milli" | name = "milli" | ||||||
| version = "0.10.2" | version = "0.11.0" | ||||||
| source = "git+https://github.com/meilisearch/milli.git?tag=v0.10.2#879d5e8799836d93f8995810965b6797be4f69d1" | source = "git+https://github.com/meilisearch/milli.git?tag=v0.11.0#c51bb6789cb3fbb6511138374b3443f9116a445c" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "bstr", |  "bstr", | ||||||
|  "byteorder", |  "byteorder", | ||||||
| @@ -1704,7 +1703,6 @@ dependencies = [ | |||||||
|  "pest 2.1.3 (git+https://github.com/pest-parser/pest.git?rev=51fd1d49f1041f7839975664ef71fe15c7dcaf67)", |  "pest 2.1.3 (git+https://github.com/pest-parser/pest.git?rev=51fd1d49f1041f7839975664ef71fe15c7dcaf67)", | ||||||
|  "pest_derive", |  "pest_derive", | ||||||
|  "rayon", |  "rayon", | ||||||
|  "regex", |  | ||||||
|  "roaring", |  "roaring", | ||||||
|  "serde", |  "serde", | ||||||
|  "serde_json", |  "serde_json", | ||||||
| @@ -1712,7 +1710,6 @@ dependencies = [ | |||||||
|  "smallstr", |  "smallstr", | ||||||
|  "smallvec", |  "smallvec", | ||||||
|  "tempfile", |  "tempfile", | ||||||
|  "tinytemplate", |  | ||||||
|  "uuid", |  "uuid", | ||||||
| ] | ] | ||||||
|  |  | ||||||
| @@ -2937,16 +2934,6 @@ dependencies = [ | |||||||
|  "syn 1.0.73", |  "syn 1.0.73", | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [[package]] |  | ||||||
| name = "tinytemplate" |  | ||||||
| version = "1.1.0" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" |  | ||||||
| dependencies = [ |  | ||||||
|  "serde", |  | ||||||
|  "serde_json", |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "tinyvec" | name = "tinyvec" | ||||||
| version = "1.2.0" | version = "1.2.0" | ||||||
|   | |||||||
| @@ -63,6 +63,7 @@ pub enum Code { | |||||||
|  |  | ||||||
|     Facet, |     Facet, | ||||||
|     Filter, |     Filter, | ||||||
|  |     Sort, | ||||||
|  |  | ||||||
|     BadParameter, |     BadParameter, | ||||||
|     BadRequest, |     BadRequest, | ||||||
| @@ -116,6 +117,8 @@ impl Code { | |||||||
|             Facet => ErrCode::invalid("invalid_facet", StatusCode::BAD_REQUEST), |             Facet => ErrCode::invalid("invalid_facet", StatusCode::BAD_REQUEST), | ||||||
|             // error related to filters |             // error related to filters | ||||||
|             Filter => ErrCode::invalid("invalid_filter", StatusCode::BAD_REQUEST), |             Filter => ErrCode::invalid("invalid_filter", StatusCode::BAD_REQUEST), | ||||||
|  |             // error related to sorts | ||||||
|  |             Sort => ErrCode::invalid("invalid_sort", StatusCode::BAD_REQUEST), | ||||||
|  |  | ||||||
|             BadParameter => ErrCode::invalid("bad_parameter", StatusCode::BAD_REQUEST), |             BadParameter => ErrCode::invalid("bad_parameter", StatusCode::BAD_REQUEST), | ||||||
|             BadRequest => ErrCode::invalid("bad_request", StatusCode::BAD_REQUEST), |             BadRequest => ErrCode::invalid("bad_request", StatusCode::BAD_REQUEST), | ||||||
|   | |||||||
| @@ -41,7 +41,6 @@ flate2 = "1.0.19" | |||||||
| fst = "0.4.5" | fst = "0.4.5" | ||||||
| futures = "0.3.7" | futures = "0.3.7" | ||||||
| futures-util = "0.3.8" | futures-util = "0.3.8" | ||||||
| grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "3adcb26" } |  | ||||||
| heed = { git = "https://github.com/Kerollmops/heed", tag = "v0.12.1" } | heed = { git = "https://github.com/Kerollmops/heed", tag = "v0.12.1" } | ||||||
| http = "0.2.1" | http = "0.2.1" | ||||||
| indexmap = { version = "1.3.2", features = ["serde-1"] } | indexmap = { version = "1.3.2", features = ["serde-1"] } | ||||||
| @@ -51,7 +50,7 @@ main_error = "0.1.0" | |||||||
| meilisearch-error = { path = "../meilisearch-error" } | meilisearch-error = { path = "../meilisearch-error" } | ||||||
| meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" } | meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" } | ||||||
| memmap = "0.7.0" | memmap = "0.7.0" | ||||||
| milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.10.2" } | milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.11.0" } | ||||||
| mime = "0.3.16" | mime = "0.3.16" | ||||||
| num_cpus = "1.13.0" | num_cpus = "1.13.0" | ||||||
| once_cell = "1.5.2" | once_cell = "1.5.2" | ||||||
|   | |||||||
| @@ -103,6 +103,7 @@ impl ErrorCode for MilliError<'_> { | |||||||
|                     UserError::PrimaryKeyCannotBeReset => Code::PrimaryKeyAlreadyPresent, |                     UserError::PrimaryKeyCannotBeReset => Code::PrimaryKeyAlreadyPresent, | ||||||
|                     UserError::UnknownInternalDocumentId { .. } => Code::DocumentNotFound, |                     UserError::UnknownInternalDocumentId { .. } => Code::DocumentNotFound, | ||||||
|                     UserError::InvalidFacetsDistribution { .. } => Code::BadRequest, |                     UserError::InvalidFacetsDistribution { .. } => Code::BadRequest, | ||||||
|  |                     UserError::InvalidSortableAttribute { .. } => Code::Sort, | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| use std::fs::File; | use std::fs::File; | ||||||
|  |  | ||||||
| use crate::index::Index; | use crate::index::Index; | ||||||
| use grenad::CompressionType; |  | ||||||
| use milli::update::UpdateBuilder; | use milli::update::UpdateBuilder; | ||||||
|  | use milli::CompressionType; | ||||||
| use rayon::ThreadPool; | use rayon::ThreadPool; | ||||||
|  |  | ||||||
| use crate::index_controller::UpdateMeta; | use crate::index_controller::UpdateMeta; | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ use std::sync::Arc; | |||||||
| use std::{error, fs}; | use std::{error, fs}; | ||||||
|  |  | ||||||
| use byte_unit::Byte; | use byte_unit::Byte; | ||||||
| use grenad::CompressionType; | use milli::CompressionType; | ||||||
| use rustls::internal::pemfile::{certs, pkcs8_private_keys, rsa_private_keys}; | use rustls::internal::pemfile::{certs, pkcs8_private_keys, rsa_private_keys}; | ||||||
| use rustls::{ | use rustls::{ | ||||||
|     AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, NoClientAuth, |     AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, NoClientAuth, | ||||||
|   | |||||||
| @@ -13,7 +13,14 @@ static DEFAULT_SETTINGS_VALUES: Lazy<HashMap<&'static str, Value>> = Lazy::new(| | |||||||
|     map.insert("distinct_attribute", json!(Value::Null)); |     map.insert("distinct_attribute", json!(Value::Null)); | ||||||
|     map.insert( |     map.insert( | ||||||
|         "ranking_rules", |         "ranking_rules", | ||||||
|         json!(["words", "typo", "proximity", "attribute", "exactness"]), |         json!([ | ||||||
|  |             "words", | ||||||
|  |             "typo", | ||||||
|  |             "sort", | ||||||
|  |             "proximity", | ||||||
|  |             "attribute", | ||||||
|  |             "exactness" | ||||||
|  |         ]), | ||||||
|     ); |     ); | ||||||
|     map.insert("stop_words", json!([])); |     map.insert("stop_words", json!([])); | ||||||
|     map.insert("synonyms", json!({})); |     map.insert("synonyms", json!({})); | ||||||
| @@ -42,7 +49,14 @@ async fn get_settings() { | |||||||
|     assert_eq!(settings["distinctAttribute"], json!(null)); |     assert_eq!(settings["distinctAttribute"], json!(null)); | ||||||
|     assert_eq!( |     assert_eq!( | ||||||
|         settings["rankingRules"], |         settings["rankingRules"], | ||||||
|         json!(["words", "typo", "proximity", "attribute", "exactness"]) |         json!([ | ||||||
|  |             "words", | ||||||
|  |             "typo", | ||||||
|  |             "sort", | ||||||
|  |             "proximity", | ||||||
|  |             "attribute", | ||||||
|  |             "exactness" | ||||||
|  |         ]) | ||||||
|     ); |     ); | ||||||
|     assert_eq!(settings["stopWords"], json!([])); |     assert_eq!(settings["stopWords"], json!([])); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user