Re: Can we delete documents based on an Id

Lahiru Gunathilake <[email protected]> Mon, 28 Feb 2011 20:21:43 +0530
Newsgroups gmane.text.xml.xindice.user
Message-ID <[email protected]>
--0015175cb82e769d65049d58d115
Content-Type: text/plain; charset=ISO-8859-1

Hi Natalia,

Cool thats a valid usecase and I prefer add a sample with this in to
DeleteDocument.java file. I will do my contribution once I am done with
these work.

Regards
Lahiru

On Mon, Feb 28, 2011 at 7:53 PM, Natalia Shilenkova
<[email protected]>wrote:

> Lahiru,
>
> Yes, the id and the document key is the same thing. Basically, when a
> resource is created, it gets assigned an id that can be used later to
> retrieve or delete that document.
>
> Regards,
> Natalia
>
> On Mon, Feb 28, 2011 at 7:20 AM, Lahiru Gunathilake <[email protected]>
> wrote:
> > Hi Natalia,
> > Thanks Natalia for the response. what do you mean by key, Is it the Id of
> > the document or can  you please tell me how to get his key.
> > I believe its the id like for a documents there's method getId(), can you
> > please confirm is that what you are referring as key ?
> > Regards
> > Lahiru
> >
> > On Mon, Feb 28, 2011 at 5:35 PM, Natalia Shilenkova <
> [email protected]>
> > wrote:
> >>
> >> On Feb 25, 2011, at 11:09 AM, Lahiru Gunathilake wrote:
> >>
> >> Hi Devs,
> >> Is there a way to delete an added resource based on an ID. My
> requirement
> >> is like this.
> >> 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.
> >> 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 = collection.getResource(key);
> >> collection.removeResource(res);
> >> This will delete the document from the collection.
> >> Regards,
> >> Natalia
> >>
> >> Regards
> >> Lahiru
> >>
> >> --
> >> Lahiru Gunathilake
> >> Senior Software Engineer - WSO2 Inc. www.wso2.com
> >>
> >> Email:[email protected] Blog: www.lahiru.org
> >> Mobile: +94716381143
> >>
> >> Lean . Enterprise . Middleware
> >>
> >>
> >
> >
> >
> > --
> > Lahiru Gunathilake
> > Senior Software Engineer - WSO2 Inc. www.wso2.com
> >
> > Email:[email protected] Blog: www.lahiru.org
> > Mobile: +94716381143
> >
> > Lean . Enterprise . Middleware
> >
> >
>



-- 
Lahiru Gunathilake
Senior Software Engineer - WSO2 Inc. www.wso2.com

Email:[email protected] Blog: www.lahiru.org
Mobile: +94716381143

Lean . Enterprise . Middleware

--0015175cb82e769d65049d58d115
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hi Natalia,</div><div><br></div>Cool thats a valid usecase and I prefe=
r add a sample with this in to DeleteDocument.java file. I will do my contr=
ibution once I am done with these work.<div><br></div><div>Regards</div>
<div>Lahiru<br><br><div class=3D"gmail_quote">On Mon, Feb 28, 2011 at 7:53 =
PM, Natalia Shilenkova <span dir=3D"ltr">&lt;<a href=3D"mailto:nshilenkova@=
gmail.com">[email protected]</a>&gt;</span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex;">
Lahiru,<br>
<br>
Yes, the id and the document key is the same thing. Basically, when a<br>
resource is created, it gets assigned an id that can be used later to<br>
retrieve or delete that document.<br>
<br>
Regards,<br>
<font color=3D"#888888">Natalia<br>
</font><div><div></div><div class=3D"h5"><br>
On Mon, Feb 28, 2011 at 7:20 AM, Lahiru Gunathilake &lt;<a href=3D"mailto:l=
[email protected]">[email protected]</a>&gt; wrote:<br>
&gt; Hi Natalia,<br>
&gt; Thanks Natalia for the response. what do you mean by key, Is it the Id=
 of<br>
&gt; the document or can =A0you please tell me how to get his key.<br>
&gt; I believe its the id like for a documents there&#39;s method getId(), =
can you<br>
&gt; please confirm is that what you are=A0referring=A0as key ?<br>
&gt; Regards<br>
&gt; Lahiru<br>
&gt;<br>
&gt; On Mon, Feb 28, 2011 at 5:35 PM, Natalia Shilenkova &lt;<a href=3D"mai=
lto:[email protected]">[email protected]</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Feb 25, 2011, at 11:09 AM, Lahiru Gunathilake wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Devs,<br>
&gt;&gt; Is there a way to delete an added resource based on an ID. My requ=
irement<br>
&gt;&gt; is like this.<br>
&gt;&gt; I am pumping in the incoming xml content to xindice while storing =
them in<br>
&gt;&gt; to a repository and when user try to remove a resource from reposi=
tory i<br>
&gt;&gt; need to remove that from the xindice too, otherwise I am keeping u=
nnecessary<br>
&gt;&gt; data on the db. By looking at your API&#39;s i couldn&#39;t find a=
 way to remove the<br>
&gt;&gt; content by parsing an ID, but during adding the resource I can kee=
p a list<br>
&gt;&gt; of ID&#39;s i have added to xindice.<br>
&gt;&gt; Do you have any solution for this or is there any other way to ach=
ieve<br>
&gt;&gt; this ?<br>
&gt;&gt;<br>
&gt;&gt; Lahiru,<br>
&gt;&gt; As far as I understand, you need something like this:<br>
&gt;&gt; String key; // document key<br>
&gt;&gt; Resource res =3D collection.getResource(key);<br>
&gt;&gt; collection.removeResource(res);<br>
&gt;&gt; This will delete the document from the collection.<br>
&gt;&gt; Regards,<br>
&gt;&gt; Natalia<br>
&gt;&gt;<br>
&gt;&gt; Regards<br>
&gt;&gt; Lahiru<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Lahiru Gunathilake<br>
&gt;&gt; Senior Software Engineer - WSO2 Inc. <a href=3D"http://www.wso2.co=
m" target=3D"_blank">www.wso2.com</a><br>
&gt;&gt;<br>
&gt;&gt; <a href=3D"mailto:Email%[email protected]">Email:[email protected]</=
a> Blog: <a href=3D"http://www.lahiru.org" target=3D"_blank">www.lahiru.org=
</a><br>
&gt;&gt; Mobile: +94716381143<br>
&gt;&gt;<br>
&gt;&gt; Lean . Enterprise . Middleware<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Lahiru Gunathilake<br>
&gt; Senior Software Engineer - WSO2 Inc. <a href=3D"http://www.wso2.com" t=
arget=3D"_blank">www.wso2.com</a><br>
&gt;<br>
&gt; <a href=3D"mailto:Email%[email protected]">Email:[email protected]</a> B=
log: <a href=3D"http://www.lahiru.org" target=3D"_blank">www.lahiru.org</a>=
<br>
&gt; Mobile: +94716381143<br>
&gt;<br>
&gt; Lean . Enterprise . Middleware<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>Lahiru Guna=
thilake<br>Senior Software Engineer - WSO2 Inc. <a href=3D"http://www.wso2.=
com">www.wso2.com</a><br><br><a href=3D"mailto:Email%[email protected]">Ema=
il:[email protected]</a> Blog: <a href=3D"http://www.lahiru.org">www.lahiru.o=
rg</a><br>
Mobile: +94716381143<br><br>Lean . Enterprise . Middleware<br><br>
</div>

--0015175cb82e769d65049d58d115--