nijuyonkadesu / Celestidesk

streamlines permission request / grant mechanism and, notifies employees whether their request has been approved or not through mail / sms
GNU Affero General Public License v3.0
0 stars 0 forks source link

feat(search): full text searching on entire transaction list #9

Closed nijuyonkadesu closed 11 months ago

nijuyonkadesu commented 11 months ago

Is your feature request related to a problem? Please describe. There's no way to properly navigate through transaction page. It will be better to do a seach on any field and find past actions. It's an useful way for MANAGER to quickly find people

Describe the solution you'd like SearchBar:

Quick Sample:

searchView.getQueryTextChangeStateFlow()
    .debounce(300)
    .filter { query ->
        if (query.isEmpty()) {
            textViewResult.text = ""
            return@filter false
        } else {
            return@filter true
        }
    }
    .distinctUntilChanged()
    .flatMapLatest { query ->
        dataFromNetwork(query)
            .catch {
                emitAll(flowOf(""))
            }
    }
    .flowOn(Dispatchers.Default)
    .collect { result ->
        textViewResult.text = result
    }

FTS4:

  1. Set Content Entity (Transaction class)
  2. Create Entity: TransactionFts (with what fields we shd consider for finding search results)
    • do: @Fts4(contentEntity)
      • don't: Map Transaction -> TransactionFts guide
  3. Include Fts entity to room: Return Flow<List<>>
  4. Search!! @Query("SELECT * FROM note_fts WHERE note_fts MATCH :searchText") smth like this

Additional context Make sure to append instead of replacing transaction list in room database.

nijuyonkadesu commented 11 months ago

Ooo have to check this https://github.com/satwanjyu/todo_compose/issues/11

this is how I found you: https://github.com/search?q=FTS4+language%3AKotlin+created%3A%3E2021-01-01&type=wikis

nijuyonkadesu commented 11 months ago

um.. I couldn't attach debounce() fancily with search view like that... um.. no flow is exposed by search view... um.. should I have to do manually and wrap edit text with flow or smth ? um...

nijuyonkadesu commented 11 months ago

image ^^^^^^^^^^^ Transaction Card