You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by David Viner <dv...@yahoo-inc.com> on 2002/08/13 03:07:47 UTC

use of insertDocument

>From some quick testing, it appears that the XMLRPC function insertDocument
when given a document name and the contents, will overwrite any pre-existing
document with that name.  Is that the intended functionality?  Or should
insertDocument fail when a pre-existing document w/ the same name exists,
forcing the user to call 'setDocument' in that case?

dave


RE: use of insertDocument

Posted by David Viner <dv...@yahoo-inc.com>.
from looking at the source of org.apache.xindice.core.Collection, the
comments seem to indicate that insertDocument should fail if the document
already exists.

   private void putDocument(Key key, Document document, boolean create)
throws DBException {
	..
      // Temporary until insert and update are separate
      Document oldDoc = getDocument(key);
      if ( oldDoc != null )
         indexManager.removeDocument(key, oldDoc);
      indexManager.addDocument(key, document);
   }

currently, insert and update are seperate calls.  setDocument calls
putDocument with false as the last param, and insertDocument calls
putDocument with true as the last param.  But this create parameter is never
checked in the putDocument method.  Is that intended?

Should insertDocument always overwrite the pre-existing document?  Should
insertDocument fail if there is a document with the same name (i.e., if(
oldDoc != null) )?  The setDocument function allows users to update
pre-existing Documents.  Also, calling insertDocument without a name
parameter allows Xindice to generate a unique name.  To me, it seems that
insertDocument('mydoc','contents') should fail if there already is a
document named 'mydoc'.

thanks

dave

-----Original Message-----
From: David Viner [mailto:dviner@yahoo-inc.com]
Sent: Monday, August 12, 2002 6:08 PM
To: Xindice-Users
Subject: use of insertDocument


>>From some quick testing, it appears that the XMLRPC function insertDocument
when given a document name and the contents, will overwrite any pre-existing
document with that name.  Is that the intended functionality?  Or should
insertDocument fail when a pre-existing document w/ the same name exists,
forcing the user to call 'setDocument' in that case?

dave