Considere an empty query search as a placeholder search #916

This commit is contained in:
qdequele 2020-08-17 17:40:07 +02:00 committed by qdequele
parent 63868b2600
commit 90226dc8a9
2 changed files with 34 additions and 28 deletions

View file

@ -105,8 +105,12 @@ impl SearchQuery {
.schema(&reader)?
.ok_or(Error::internal("Impossible to retrieve the schema"))?;
let mut search_builder = index.new_search(self.q.clone());
let query = self
.q
.clone()
.and_then(|q| if q.is_empty() { None } else { Some(q) });
let mut search_builder = index.new_search(query);
if let Some(offset) = self.offset {
search_builder.offset(offset);
}