function and/or mapping?

I would like to perform this task with tamino (via X-Application):

send a query string like
…/HotlineAnfrage[/Hotlineanfrage/Frage=“myquerystring”] (threshold=40)

Now tamino should return all nodes “HotlineAnfrage” with an additional Element “coincidence” that should be calculated from “myquerystring” and the value of field “Frage” (one thing I want to try here are n-grams: counting how many “chops” of e.g. 3 characters of the search string can be found in the database. All found -> coincidence = 100, none found -> coincidence = 0)

The resultset should be ordered by the field “coincidence”. All result with coincidence below “threshold” should be omitted.

example:

—> "warum ist banane"


75
Warum ist die Banane krumm?
tut nicht zur Sache …



50
Warum ist die Orange rund?
tut nicht zur Sache …


0
Wo war der Besen?
tut nicht zur Sache …


Is it possible to do this with server extensions - if not, where else can I look - if yes, can you pls. give me a couple of hints on how to proceed?

Thanks, Ralf.

/* */