[Zope] Re: DocumentLbrary with databases

Casey Duncan casey@zope.com
Mon, 7 Oct 2002 22:49:33 -0400


On Monday 07 October 2002 02:56 pm, Ken wrote:
[snip]
> I am using DocumentLibrary as a search engine, indexing remote pages an=
d=20
returning results pointing to the page on the remote server (the 'source'=
=20
property). Thus, once the page is indexed I could delete it (as long as t=
here=20
is no need to reindex). But can I delete the original document and keep o=
nly=20
the catalogued 'brain'?

Yes and no (depending on how hard you try).

Probably the easiest way to do this would be to create a Subclass of=20
DocumentFile that did not store the document data persistently, but fetch=
ed=20
in on demand when the object was cataloged, and possibly redirected a bro=
wser=20
to the remote URL when the document was accessed.

This would not be difficult and would mostly involve overriding the add, =
edit=20
and PrincipiaSearchSourch methods of DocumentFile. There is already code =
in=20
there to fetch remote data (using urllib), so that parts already done.

You could not get rid of the object entirely though, unless you created a=
=20
traversal hook in the Documents object which pretended to make it exist. =
This=20
is probably more trouble then it is worth though.

As for using an external database (as was originally asked), I'm not sure=
 why=20
you would want to as most relational databases BLOB support is inefficien=
t,=20
but it could be accomplished in a similar manner, using database queries =
in=20
place of urllib.=20

-Casey

>=20
> Anyone?
>=20
> TIA,
>=20
> Ken