Closed chrisjmccrum closed 4 years ago
Can't you simply set a variable and modify it based on the search criteria? For example:
let conditions = [{ name: searchCriteria.keywords }]
if (searchCriteria.industry !== "any" {
conditions.push({ accountType: searchCriteria.accountType )
}
var result = this.fuse.search({ $and: conditions })
Thank you - I had a feeling I was over complicating it! This works just fine :)
First off - want to say this library is great and very useful already! I'm looking to build a search panel that has more than just a simple text input for search. For the sake of simplicity, let's say I only have two search fields.
Text Input Keyword Search of Account Names
Dropdown Account Type [Options are: Any, Commercial, Residential, Government] (Default Value is Any)
The data object looks like this:
[{ name: 'ABC Company', accountType: 'Commercial' }, { name: 'Lakehouse', accountType: 'Residential' }]
What I would like to do is to be able to either: