package org.orioai.indexing;
import org.orioai.indexing.exception.ISDeleteException;
import org.orioai.indexing.exception.ISIndexException;
import org.orioai.indexing.exception.ISNoticeProviderConnectionFailed;
import org.orioai.indexing.exception.ISSearchException;
import org.orioai.indexing.exception.ISUpdateException;
import org.orioai.indexing.search.SearchResults;
/**
* Interface presentant toutes les methodes publiques de l'indexeur
*
* @author ycaillaux
*
*/
public interface IndexingServiceInterface
{
/**
* Methode d'indexation classique
*
* @param notice : Fiche a indexer
* @param identifier : Identifiant de la fiche
* @param namespace : Namespace de la fiche
* @param datestamp : Datestamp de la fiche
* @param repository : Repository de la fiche
* @param doOptimize : Optimisation de l'index
* @return Renvoie un entier indiquant le bon deroulement de l'indexation
* @throws ISIndexException
*/
public int index(String notice, String identifier, String namespace, String datestamp, String repository, boolean doOptimize) throws ISIndexException;
/**
* Methode de mise a jour de l'index
*
* @param notice : Fiche a mettre a jour
* @param identifier : Identifiant de la fiche
* @param namespace : Namespace de la fiche
* @param datestamp : Datestamp de la fiche
* @param repository : Repository de la fiche
* @param doOptimize : Optimisation de l'index
* @return Renvoie un entier indiquant le bon deroulement de l'indexation
* @throws ISDeleteException
* @throws ISUpdateException
* @throws ISIndexException
*/
public int update(String notice, String identifier, String namespace, String datestamp, String repository, boolean doOptimize) throws ISDeleteException, ISUpdateException, ISIndexException;
/**
* Methode qui vide un cache
*
* @param name : Nom du cache a vider
*/
public void clearCache(String name);
/**
* Methode qui donne le nombre de resultats d'une requete
*
* @param request : Requete
* @return Entier long indiquant le nombre de resultats
* @throws ISSearchException
*/
public long searchForNumberOfResults(String request) throws ISSearchException;
/**
* Methode qui donne le nombre de resultats de plusieurs requetes
*
* @param request : Tableau contenant toutes les requetes
* @return Tableau d'entiers long indiquant le nombre de resultats pour chaque requete
*/
public long[] searchForSomeNumberOfResults(String request[])throws ISSearchException;
/**
* Methode de recherche d'une fiche XML
*
* @param identifier : Identifiant de la fiche
* @param repository : Repository de la fiche
* @param namespace : Namespace de la fiche
* @return Renvoie une chaine correspondant a la fiche
* @throws ISNoticeProviderConnectionFailed
* @throws ISSearchException
*/
public String searchXMLDoc(String identifier, String repository, String namespace) throws ISNoticeProviderConnectionFailed, ISSearchException;
/**
* Methode de recherche de documents XML
*
* @param request : Requete
* @param firstNotice : Premier resultat souhaite
* @param lastNotice : Dernier resultat souhaite
* @return Renvoie un objet de type SearchResults
* @throws ISNoticeProviderConnectionFailed
* @throws ISSearchException
*/
public SearchResults searchXMLDocs(String request, int firstNotice, int lastNotice) throws ISNoticeProviderConnectionFailed, ISSearchException;
/**
* Methode de recherche par attributs
*
* @param request : Requete
* @param sortAttributes : Attributs de tri
* @param firstNotice : Premier resultat souhaite
* @param lastNotice : Dernier resultat souhaite
* @param attributes : Attributs dont ont souhaite connaitre les valeurs
* @param ascending : Ordre croissant
* @return Renvoie un objet de type SearchResults
* @throws ISSearchException
*/
public SearchResults searchFromAttributes(String request, String[] sortAttributes, int firstNotice, int lastNotice, String[] attributes, boolean ascending) throws ISSearchException;
/**
* Methode de recherche des valeurs uniques de l'index
*
* @param xpath : xpath dont on souhaite connaitre les valeurs uniques
* @return Renvoie toutes les valeurs uniques
* @throws ISSearchException
*/
public String[] uniqueValues(String xpath) throws ISSearchException;
/**
* Methode d'indexation ou de mise a jour d'une fiche
*
* @param notice : Fiche a indexer
* @param identifier : Identifiant de la fiche
* @param namespace : Namespace de la fiche
* @param datestamp : Datestamp de la fiche
* @param repository : Repository de la fiche
* @return Renvoie un entier indiquant le bon deroulement de la methode
* @throws ISDeleteException
* @throws ISIndexException
*/
public int indexOrUpdate(String notice, String identifier, String namespace, String datestamp, String repository) throws ISDeleteException, ISIndexException;
/**
* Methode de suppression d'une fiche dans l'index
*
* @param identifier : Identifiant de la fiche
* @param namespace : Namespace de la fiche
* @return Renvoie un entier indiquant le bon deroulement de la suppression
* @throws ISDeleteException
*/
public int deleteNotice(String identifier, String namespace) throws ISDeleteException;
/**
* Methode de suppression de plusieurs fiches dans l'index
*
* @param identifiers : Identifants des fiches
* @param namespaces : Namespaces associes aux identifiants des fiches
* @return Renvoie un tableau d'entiers indiquant le bon deroulement
* de chaque suppression
* @throws ISDeleteException
*/
public int[] deleteNotices(String[] identifiers, String[] namespaces) throws ISDeleteException;
}