/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.search.solr.internal;

import java.io.IOException;
import java.util.List;

import javax.inject.Inject;

import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.SolrParams;
import org.slf4j.Logger;
import org.xwiki.search.solr.internal.api.SolrInstance;

/**
 * Basic implementation for the wrapped instance.
 * 
 * @see SolrInstance
 * @version $Id$
 * @since 4.3M2
 */
public abstract class AbstractSolrInstance implements SolrInstance
{
    /**
     * Solr server instance corresponding, depending on the subclass.
     */
    protected SolrServer server;

    /**
     * Logging framework.
     */
    @Inject
    protected Logger logger;

    @Override
    public void add(SolrInputDocument solrDocument) throws SolrServerException, IOException
    {
        this.server.add(solrDocument);
    }

    @Override
    public void add(List<SolrInputDocument> solrDocuments) throws SolrServerException, IOException
    {
        this.server.add(solrDocuments);
    }

    @Override
    public void delete(String id) throws SolrServerException, IOException
    {
        this.server.deleteById(id);
    }

    @Override
    public void delete(List<String> ids) throws SolrServerException, IOException
    {
        this.server.deleteById(ids);
    }

    @Override
    public void deleteByQuery(String query) throws SolrServerException, IOException
    {
        this.server.deleteByQuery(query);
    }

    @Override
    public void commit() throws SolrServerException, IOException
    {
        this.server.commit();
    }

    @Override
    public void rollback() throws SolrServerException, IOException
    {
        this.server.rollback();
    }

    @Override
    public QueryResponse query(SolrParams solrParams) throws SolrServerException
    {
        QueryResponse result = this.server.query(solrParams);
        return result;
    }

    /**
     * Useful when testing.
     * 
     * @return the server
     */
    protected SolrServer getServer()
    {
        return this.server;
    }
}

@@ -1847,32 +1847,109 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Add Solr document %5B%7B%7D%5D to index%22, solrDocument);%0A%0A
         this.ser
@@ -1971,16 +1971,16 @@
 ument);%0A
-
     %7D%0A%0A 
@@ -2089,32 +2089,111 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Add Solr documents %5B%7B%7D%5D to index%22, solrDocuments);%0A%0A
         this.ser
@@ -2309,32 +2309,104 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Delete Solr document %5B%7B%7D%5D from index%22, id);%0A%0A
         this.ser
@@ -2525,32 +2525,106 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Delete Solr documents %5B%7B%7D%5D from index%22, ids);%0A%0A
         this.ser
@@ -2747,32 +2747,123 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Delete Solr documents from index based on query %5B%7B%7D%5D%22, query);%0A%0A
         this.ser
@@ -2972,32 +2972,86 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Commit changes to Solr%22);%0A%0A
         this.ser
@@ -3150,32 +3150,88 @@
 Exception%0A    %7B%0A
+        this.logger.debug(%22Rollback changes to Solr%22);%0A%0A
         this.ser
@@ -3340,38 +3340,105 @@
 ServerException%0A
-
     %7B%0A
+        this.logger.debug(%22Execute Solr query %5B%7B%7D%5D%22, solrParams);%0A%0A
         QueryRes

Add debug log