Internal search: Return all document ids when no filters are provided
This commit is contained in:
@@ -53,13 +53,9 @@ impl Store {
|
|||||||
.details("Account ID must be specified before other filters"));
|
.details("Account ID must be specified before other filters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "test_mode")]
|
let mut results;
|
||||||
{
|
|
||||||
if query.filters.len() == 1 {
|
|
||||||
state.bm = Some(mask.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if query.filters.len() > 1 {
|
||||||
let mut filters = query.filters.into_iter().peekable();
|
let mut filters = query.filters.into_iter().peekable();
|
||||||
while let Some(filter) = filters.next() {
|
while let Some(filter) = filters.next() {
|
||||||
let mut result = match filter {
|
let mut result = match filter {
|
||||||
@@ -98,7 +94,9 @@ impl Store {
|
|||||||
for token in Stemmer::new(&value, language, MAX_TOKEN_LENGTH) {
|
for token in Stemmer::new(&value, language, MAX_TOKEN_LENGTH) {
|
||||||
let mut tokens = Vec::with_capacity(3);
|
let mut tokens = Vec::with_capacity(3);
|
||||||
tokens.push(CheekyHash::new(token.word.as_bytes()));
|
tokens.push(CheekyHash::new(token.word.as_bytes()));
|
||||||
tokens.push(CheekyHash::new(format!("{}*", token.word).as_bytes()));
|
tokens.push(CheekyHash::new(
|
||||||
|
format!("{}*", token.word).as_bytes(),
|
||||||
|
));
|
||||||
if let Some(stemmed_word) = token.stemmed_word {
|
if let Some(stemmed_word) = token.stemmed_word {
|
||||||
tokens.push(CheekyHash::new(
|
tokens.push(CheekyHash::new(
|
||||||
format!("{stemmed_word}*").as_bytes(),
|
format!("{stemmed_word}*").as_bytes(),
|
||||||
@@ -188,7 +186,14 @@ impl Store {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
range_to_bitmap(self, query.index, account_id, field.u8_id(), &value, op)
|
range_to_bitmap(
|
||||||
|
self,
|
||||||
|
query.index,
|
||||||
|
account_id,
|
||||||
|
field.u8_id(),
|
||||||
|
&value,
|
||||||
|
op,
|
||||||
|
)
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
return Err(trc::StoreEvent::UnexpectedError
|
return Err(trc::StoreEvent::UnexpectedError
|
||||||
@@ -259,8 +264,12 @@ impl Store {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut results = state.bm.unwrap_or_default();
|
results = state.bm.unwrap_or_default();
|
||||||
results.bitand_assign(&mask);
|
results.bitand_assign(&mask);
|
||||||
|
} else {
|
||||||
|
results = mask;
|
||||||
|
}
|
||||||
|
|
||||||
if results.len() > 1 && !query.comparators.is_empty() {
|
if results.len() > 1 && !query.comparators.is_empty() {
|
||||||
let mut comparators = Vec::with_capacity(query.comparators.len());
|
let mut comparators = Vec::with_capacity(query.comparators.len());
|
||||||
for comparator in query.comparators {
|
for comparator in query.comparators {
|
||||||
|
|||||||
Reference in New Issue
Block a user