mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-30 15:36:28 +00:00 
			
		
		
		
	Check the exact_word database when computing zero typo query
This commit is contained in:
		| @@ -128,6 +128,40 @@ async fn search_with_stop_word() { | |||||||
|           .await; |           .await; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #[actix_rt::test] | ||||||
|  | async fn search_with_typo_settings() { | ||||||
|  |     // related to https://github.com/meilisearch/meilisearch/issues/5240 | ||||||
|  |     let server = Server::new().await; | ||||||
|  |     let index = server.index("test"); | ||||||
|  |  | ||||||
|  |     let (_, code) = index | ||||||
|  |         .update_settings(json!({"typoTolerance": { "disableOnAttributes": ["title", "id"]}})) | ||||||
|  |         .await; | ||||||
|  |     meili_snap::snapshot!(code, @"202 Accepted"); | ||||||
|  |  | ||||||
|  |     let documents = DOCUMENTS.clone(); | ||||||
|  |     let (task, _status_code) = index.add_documents(documents, None).await; | ||||||
|  |     index.wait_task(task.uid()).await.succeeded(); | ||||||
|  |  | ||||||
|  |     index | ||||||
|  |         .search(json!({"q": "287947" }), |response, code| { | ||||||
|  |             assert_eq!(code, 200, "{}", response); | ||||||
|  |             snapshot!(json_string!(response["hits"]), @r###" | ||||||
|  |             [ | ||||||
|  |               { | ||||||
|  |                 "title": "Shazam!", | ||||||
|  |                 "id": "287947", | ||||||
|  |                 "color": [ | ||||||
|  |                   "green", | ||||||
|  |                   "blue" | ||||||
|  |                 ] | ||||||
|  |               } | ||||||
|  |             ] | ||||||
|  |             "###); | ||||||
|  |         }) | ||||||
|  |         .await; | ||||||
|  | } | ||||||
|  |  | ||||||
| #[actix_rt::test] | #[actix_rt::test] | ||||||
| async fn phrase_search_with_stop_word() { | async fn phrase_search_with_stop_word() { | ||||||
|     // related to https://github.com/meilisearch/meilisearch/issues/3521 |     // related to https://github.com/meilisearch/meilisearch/issues/3521 | ||||||
|   | |||||||
| @@ -215,7 +215,7 @@ pub fn partially_initialized_term_from_word( | |||||||
|     let mut zero_typo = None; |     let mut zero_typo = None; | ||||||
|     let mut prefix_of = BTreeSet::new(); |     let mut prefix_of = BTreeSet::new(); | ||||||
|  |  | ||||||
|     if fst.contains(word) { |     if fst.contains(word) || ctx.index.exact_word_docids.get(ctx.txn, word)?.is_some() { | ||||||
|         zero_typo = Some(word_interned); |         zero_typo = Some(word_interned); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user