How to call View map every time /

Hi,

I want to create view map every time for search different different key based on user input .
How i do that ?
Like , user enter a group code ,then i need to search into db , i need to create a view based on
user input.

   groupView = mDatabase.getView("list/groups");
        groupView.setMap(new Mapper() {
            @Override
            public void map(Map<String, Object> document, Emitter emitter) {
                String type = (String) document.get("type");
                if ("group".equals(type) && ((int) document.get("code"))== Integer.parseInt(code) ) {
                    emitter.emit(document.get("created_at"), null);
                    System.out.println("Got row"+code);
                }
            }
        }, "1.0");

    groupLiveQuery = groupView.createQuery().toLiveQuery();

But it is called only first time . Please help me

Emit what the user is inputting as the key in your view and then query the view with specific keys (https://developer.couchbase.com/documentation/mobile/current/guides/couchbase-lite/native-api/query/index.html#querying-key-ranges) to get documents for that user input.