def smart_search_pool(self):
        """ Perform a smart pool search.

            The "smart" search function tries extract a query from
            a text string. This query is then passed to the search_pool
            function, which performs the search.
        """

        search_options = {}

        if 'query_id' in request.json:
            search_options['query_id'] = request.json['query_id']

        if 'max_result' in request.json:
            search_options['max_result'] = request.json['max_result']
        if 'offset' in request.json:
            search_options['offset'] = request.json['offset']

        try:
            result = Pool.smart_search(request.json['query_string'],
                search_options
                )
            # Remove error key in result from backend as it interferes with the
            # error handling of the web interface.
            # TODO: Reevaluate how to deal with different types of errors; soft
            # errors like query string parser errors and hard errors like lost
            # database.
            del result['error']
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        return json.dumps(result, cls=NipapJSONEncoder)
def smart_search_pool ( self ) : search_options = { } if 'query_id' in request . json : search_options [ 'query_id' ] = request . json [ 'query_id' ] if 'max_result' in request . json : search_options [ 'max_result' ] = request . json [ 'max_result' ] if 'offset' in request . json : search_options [ 'offset' ] = request . json [ 'offset' ] try : result = Pool . smart_search ( request . json [ 'query_string' ] , search_options ) del result [ 'error' ] except NipapError , e : return json . dumps ( { 'error' : 1 , 'message' : e . args , 'type' : type ( e ) . __name__ } ) return json . dumps ( result , cls = NipapJSONEncoder )
Perform a smart pool search.

            The "smart" search function tries extract a query from
            a text string. This query is then passed to the search_pool
            function, which performs the search.