mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Merge #257
257: Fix unconditional facet indexing r=Kerollmops a=Kerollmops We were indexing every searchable field as filterable, this was a mistake. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
c38b0b883d
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -901,7 +901,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "helpers"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byte-unit",
|
||||
@ -955,7 +955,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http-ui"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"askama",
|
||||
@ -1098,7 +1098,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "infos"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byte-unit",
|
||||
@ -1377,7 +1377,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "milli"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"big_s",
|
||||
"bstr",
|
||||
@ -2232,7 +2232,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "search"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byte-unit",
|
||||
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
milli = { path = "../milli" }
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "helpers"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "http-ui"
|
||||
description = "The HTTP user interface of the milli search engine"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "infos"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "milli"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Kerollmops <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -55,7 +55,7 @@ pub struct Readers {
|
||||
pub struct Store<'s, A> {
|
||||
// Indexing parameters
|
||||
searchable_fields: HashSet<FieldId>,
|
||||
faceted_fields: HashSet<FieldId>,
|
||||
filterable_fields: HashSet<FieldId>,
|
||||
// Caches
|
||||
word_docids: LinkedHashMap<SmallVec32<u8>, RoaringBitmap>,
|
||||
word_docids_limit: usize,
|
||||
@ -90,7 +90,7 @@ pub struct Store<'s, A> {
|
||||
impl<'s, A: AsRef<[u8]>> Store<'s, A> {
|
||||
pub fn new(
|
||||
searchable_fields: HashSet<FieldId>,
|
||||
faceted_fields: HashSet<FieldId>,
|
||||
filterable_fields: HashSet<FieldId>,
|
||||
linked_hash_map_size: Option<usize>,
|
||||
max_nb_chunks: Option<usize>,
|
||||
max_memory: Option<usize>,
|
||||
@ -190,7 +190,7 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> {
|
||||
Ok(Store {
|
||||
// Indexing parameters.
|
||||
searchable_fields,
|
||||
faceted_fields,
|
||||
filterable_fields,
|
||||
// Caches
|
||||
word_docids: LinkedHashMap::with_capacity(linked_hash_map_size),
|
||||
field_id_word_count_docids: HashMap::new(),
|
||||
@ -668,20 +668,23 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> {
|
||||
}
|
||||
|
||||
for (attr, content) in document.iter() {
|
||||
if self.faceted_fields.contains(&attr) || self.searchable_fields.contains(&attr)
|
||||
if self.filterable_fields.contains(&attr)
|
||||
|| self.searchable_fields.contains(&attr)
|
||||
{
|
||||
let value =
|
||||
serde_json::from_slice(content).map_err(InternalError::SerdeJson)?;
|
||||
|
||||
let (facet_numbers, facet_strings) = extract_facet_values(&value);
|
||||
facet_numbers_values
|
||||
.entry(attr)
|
||||
.or_insert_with(Vec::new)
|
||||
.extend(facet_numbers);
|
||||
facet_strings_values
|
||||
.entry(attr)
|
||||
.or_insert_with(Vec::new)
|
||||
.extend(facet_strings);
|
||||
if self.filterable_fields.contains(&attr) {
|
||||
let (facet_numbers, facet_strings) = extract_facet_values(&value);
|
||||
facet_numbers_values
|
||||
.entry(attr)
|
||||
.or_insert_with(Vec::new)
|
||||
.extend(facet_numbers);
|
||||
facet_strings_values
|
||||
.entry(attr)
|
||||
.or_insert_with(Vec::new)
|
||||
.extend(facet_strings);
|
||||
}
|
||||
|
||||
if self.searchable_fields.contains(&attr) {
|
||||
let content = match json_to_string(&value) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "search"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user