Re: Can we delete documents based on an Id

Natalia Shilenkova <[email protected]> Mon, 28 Feb 2011 07:05:28 -0500
Newsgroups gmane.text.xml.xindice.user
Message-ID <[email protected]>
--Apple-Mail-7-612465555
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On Feb 25, 2011, at 11:09 AM, Lahiru Gunathilake wrote:

> Hi Devs,
>=20
> Is there a way to delete an added resource based on an ID. My =
requirement is like this.
>=20
> I am pumping in the incoming xml content to xindice while storing them =
in to a repository and when user try to remove a resource from =
repository i need to remove that from the xindice too, otherwise I am =
keeping unnecessary data on the db. By looking at your API's i couldn't =
find a way to remove the content by parsing an ID, but during adding the =
resource I can keep a list of ID's i have added to xindice.
>=20
> Do you have any solution for this or is there any other way to achieve =
this ?

Lahiru,

As far as I understand, you need something like this:

String key; // document key
Resource res =3D collection.getResource(key);
collection.removeResource(res);

This will delete the document from the collection.

Regards,
Natalia

>=20
> Regards
> Lahiru
>=20
> --=20
> Lahiru Gunathilake
> Senior Software Engineer - WSO2 Inc. www.wso2.com
>=20
> Email:[email protected] Blog: www.lahiru.org
> Mobile: +94716381143
>=20
> Lean . Enterprise . Middleware
>=20


--Apple-Mail-7-612465555
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii

<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 25, 2011, at 11:09 AM, Lahiru Gunathilake wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Devs,<div><br></div><div>Is there a way to delete an added resource based on an ID. My requirement is like this.</div><div><br></div><div>I am pumping in the incoming xml content to xindice while storing them in to a repository and when user try to remove a resource from repository i need to remove that from the xindice too, otherwise I am keeping unnecessary data on the db. By looking at your API's i couldn't find a way to remove the content by parsing an ID, but during adding the resource I can keep a list of ID's i have added to 
 xindice.</div>
<div><br></div><div>Do you have any solution for this or is there any other way to achieve this ?</div></blockquote><div><br></div><div>Lahiru,</div><div><br></div><div>As far as I understand, you need something like this:</div><div><br></div><div>String key; // document key</div><div><div>Resource res = collection.getResource(key);</div><div>collection.removeResource(res);</div><div><br></div><div>This will delete the document from the collection.</div><div><br></div><div>Regards,</div><div>Natalia</div></div><br><blockquote type="cite"><div><br></div><div>Regards</div><div>Lahiru<br clear="all"><br>-- <br>Lahiru Gunathilake<br>Senior Software Engineer - WSO2 Inc. <a href="http://www.wso2.com/">www.wso2.com</a><br>
<br><a href="mailto:Email%[email protected]">Email:[email protected]</a> Blog: <a href="http://www.lahiru.org/">www.lahiru.org</a><br>Mobile: +94716381143<br><br>Lean . Enterprise . Middleware<br><br>
</div>
</blockquote></div><br></body></html>
--Apple-Mail-7-612465555--