     hx.defined validFilters
 
 
-getFiltered = (rows, term, filtered, filterCacheTerm, fn) ->
-  if (term?.length and (filtered is undefined or filterCacheTerm isnt term))
+getFiltered = (rows, term, filterCache, filterCacheTerm, fn) ->
+  # term can be a string (regular filter) or an array (advanced search)
+  if (term?.length and (filterCache is undefined or filterCacheTerm isnt term))
     rows.filter fn
-  else if filtered is undefined or not term?.length
+  else if filterCache is undefined or not term?.length
     rows.slice()
   else
-    filtered
+    filterCache
 
 objectFeed = (data, options) ->
   options = hx.merge({

  options.advancedSearch ?= getAdvancedSearchFilter(options.cellValueLookup, options.termLookup)

  # cached values
  filtered = undefined
  filterCacheTerm = undefined
  sorted = undefined
  sortCacheTerm = {}

    totalCount: (cb) -> cb(data.rows.length)
    rows: (range, cb) ->
      if range.sort?.column isnt sortCacheTerm.column
        filterCache = undefined

      if range.useAdvancedSearch
        advancedSearchFilterFn = (row) -> options.advancedSearch(range.advancedSearch, row)
        filterCache = getFiltered(data.rows, range.advancedSearch, filterCache, filterCacheTerm, advancedSearchFilterFn)
        filterCacheTerm = range.advancedSearch
        sorted = undefined
      else
        filterFn = (row) -> options.filter(range.filter, row)
        filterCache = getFiltered(data.rows, range.filter, filterCache, filterCacheTerm, filterFn)
        filterCacheTerm = range.filter
        sorted = undefined

