On 6/18/13 12:37 PM, "Robert Munteanu" <[email protected]> wrote:
>> @Override
>> protected void doPost(
>> SlingHttpServletRequest request,
>> SlingHttpServletResponse response
>> ) throws ServletException, IOException {
>>
>> // [...]
>> Resource resource = request.getResource();
>> Node node = resource.adaptTo(Node.class);
>> node.setProperty("x", "y");
>> node.getSession().save();
>> // [...]
>>
>> }
>
>
>The code looks fine to me, although I'd advise just using the Resource
>API if possible, since you already have the resource at hand.
I simplified the example. The actual code is nested somewhere else, and
needs the Node reference.
>>Now, through debugging, I have noticed that the change I made above did
>> not update Jackrabbit's index. Before I try to write up a reproducible
>> test case:
>
>Is that the Lucene index? Or is the property not updated at all?
Yes, the Lucene index. The property is correctly updated. But I forgot to
mention that I've been tampering with the aggregate rules, so it may well
be that I did something wrong in that area.
Further debugging showed that the change set was not assessed "eligible"
for index updates by o.a.j.core.query.lucene.SearchIndex. I guess I broke
something in that area...
>
>> 1. Is this a known issue?
>> 2. Am I misusing API (e.g. session.save())?
>
>See above, I think it's fine.
OK, thanks for your feedback!
Cheers
Lukas
>
>Robert
>
>>
>> I've noticed that Sling's PostOperation uses ResourceResolver.commit(),
>> although that doesn't seem to make the difference.
>>
>> Cheers
>> Lukas
>>