Beispiel #1
0
    def execute(self):
        fieldprefix = 'fts:'
        if self.field.startswith(fieldprefix):
            logg.debug('OAISearchParser: ---> calling fts:' + self.field + " " + self.op + " " + self.value)
            from core.tree import searcher
            return searcher.run_search(self.field.replace(fieldprefix, ''), self.op, self.value)

        if self.field == 'schema' and self.op == '=':
            logg.debug('OAISearchParser: ---> getting nodes with type %s', self.value)
            node_ids = tree.db.get_nids_by_type_suffix(self.value)

        elif self.field and self.op and self.value:
            sql = "SELECT id FROM node, nodeattribute WHERE id=nid AND nodeattribute.name=%s AND nodeattribute.value " + self.op + " %s"
            params = (self.field, self.value)
            logg.debug('OAISearchParser: ---> going to execute sql: %s with params %s', sql, params)
            res = tree.db.runQuery(sql, *params)
            node_ids = [x[0] for x in res]
        else:
            logg.debug('OAISearchParser: ---> OAISearchParser: Error evaluating FieldCondition')
            return []
        logg.debug('OAISearchParser: ---> sql returned %d results', len(node_ids))
        return list(set(node_ids))
Beispiel #2
0
 def execute(self):
     from core.tree import searcher
     return searcher.run_search(self.field, self.op, self.value)
Beispiel #3
0
    def execute(self):
        from core.tree import searcher

        return searcher.run_search(self.field, self.op, self.value)