cangjie: Factor code in cangjie_get_filter_query

```
$ make distcheck
[...]
================================================
libcangjie-1.0 archives ready for distribution: 
libcangjie-1.0.tar.xz
================================================
```