Class TextIndexServiceImpl

java.lang.Object
com.mindstore.backend.service.TextIndexServiceImpl
All Implemented Interfaces:
TextIndexService

@Service public class TextIndexServiceImpl extends Object implements TextIndexService
Implementation of the TextIndexService interface, implements relevant functions for rest controller
  • Constructor Details

    • TextIndexServiceImpl

      public TextIndexServiceImpl(org.opensearch.client.opensearch.OpenSearchClient client)
      text index service implementation
      Parameters:
      client - opensearchclient
  • Method Details

    • indexText

      public void indexText(TextDocument text)
      used to index texts into the opensearch index
      Specified by:
      indexText in interface TextIndexService
      Parameters:
      text - the TextDocument we want to index
    • existsByTitle

      public boolean existsByTitle(String title)
      function that returns a boolean to indicate if a documents exists by a title
      Specified by:
      existsByTitle in interface TextIndexService
      Parameters:
      title - string
      Returns:
      true or false
    • deleteAll

      public void deleteAll() throws IOException
      deletes all text documents in the index
      Specified by:
      deleteAll in interface TextIndexService
      Throws:
      IOException - when deletion fails
    • delete

      public void delete(Integer id) throws IOException
      deletes a single text document by id
      Specified by:
      delete in interface TextIndexService
      Parameters:
      id - - the textDocument id to delete
      Throws:
      IOException - when deletion fails