How can i use easySearch to fuzzy search a document id?


#1

For example i have a document which have this id ‘001-00000081’ and i want to search only 81.
this is my easySearch configuration

  EasySearch.createSearchIndex('ice_orders', {
  collection: Ice.Collection.Order,
  field: ['_id', 'iceCustomerId','_customer.name', '_staff.name'],
  use: 'mongo-db',
  limit: 10,
  convertNumbers: true,
  props: {
    'filteredPayment': 'all'
  },
  query: function (searchString) {
    // Default query that will be used for searching
    var query = EasySearch.getSearcher(this.use).defaultQuery(this, searchString);
    // filter for categories if set
    if (this.props.filteredPayment !== 'all') {
      query.closing = eval(this.props.filteredPayment);
    }

    return query;
  }
});