def _performSearch(self, queryParser,query):
        q = queryParser.parse(query)

        self._prepareSearcher()
        hits = self._searcher.search(q)
        result = []
        for i in range(0, hits.length()):
            d = hits.doc(i)
            result.append(FoafDocumentFactory.getFOAFFromDocument(d))
        return result
Exemplo n.º 2
0
    def indexFOAF(self, foaf):
        document = FoafDocumentFactory.getDocumentFromFOAF(foaf)
        self._writer.addDocument(document)
        self.countInsertion()
        if ( foaf.has_key('sha')):
            for sha in foaf['sha']:
                self.shaBBDD.insertUriSha(foaf['uri'][0], sha)

        if ( foaf.has_key('friends')):
            for friendSha, friendUri in filter( lambda x: x[0] != '', foaf['friends']):
                self.shaBBDD.insertUriSha(friendUri, friendSha)
            return [u for (v,u) in foaf['friends']]
        return []