Construct a Set using the from_dirty method

This commit fixes #566 by ensuring that the slice of matches is
ordered and deduplicated.
This commit is contained in:
Clément Renault 2020-03-30 20:56:26 +02:00
parent e3808b8694
commit c18e907f96
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -531,7 +531,7 @@ pub fn traverse_query_tree<'o, 'txn>(
let docids = SetBuf::new(docids).unwrap(); let docids = SetBuf::new(docids).unwrap();
debug!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2); debug!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2);
let matches = Cow::Owned(SetBuf::new(matches).unwrap()); let matches = Cow::Owned(SetBuf::from_dirty(matches));
let key = PostingsKey { query, input: vec![], distance: 0, is_exact: true }; let key = PostingsKey { query, input: vec![], distance: 0, is_exact: true };
postings.insert(key, matches); postings.insert(key, matches);