1. A method of applying a user-defined relevance function comprising: decomposing a complex search query into a simple operator; associating said simple operator with said user-defined relevance function; retrieving a matching document matching said complex search query; and computing a rank for said matching document, using said user-defined relevance function.