Tabnine Logo
ElasticSearchIndexer.index
Code IndexAdd Tabnine to your IDE (free)

How to use
index
method
in
org.apache.james.backends.es.ElasticSearchIndexer

Best Java code snippets using org.apache.james.backends.es.ElasticSearchIndexer.index (Showing top 4 results out of 315)

origin: org.apache.james/apache-james-mailbox-quota-search-elasticsearch

private void handleEvent(User user, QuotaUsageUpdatedEvent event) throws JsonProcessingException {
  indexer.index(user.getUserName(), 
      quotaRatioToElasticSearchJson.convertToJson(user.getUserName(), event));
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
public void addShouldIndex() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  MailboxMessage message = mockedMessage(MESSAGE_UID);
  
  when(messageToElasticSearchJson.convertToJson(eq(message), eq(users)))
    .thenReturn(EXPECTED_JSON_CONTENT);
  
  //When
  testee.add(session, mailbox, message);
  
  //Then
  verify(elasticSearchIndexer).index(eq(ELASTIC_SEARCH_ID), eq(EXPECTED_JSON_CONTENT));
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
public void addShouldIndexEmailBodyWhenNotIndexableAttachment() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  
  MailboxMessage message = mockedMessage(MESSAGE_UID);
  
  when(messageToElasticSearchJson.convertToJson(eq(message), eq(users)))
    .thenThrow(JsonProcessingException.class);
  
  when(messageToElasticSearchJson.convertToJsonWithoutAttachment(eq(message), eq(users)))
    .thenReturn(EXPECTED_JSON_CONTENT);
  
  //When
  testee.add(session, mailbox, message);
  
  //Then
  verify(elasticSearchIndexer).index(eq(ELASTIC_SEARCH_ID), eq(EXPECTED_JSON_CONTENT));
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Override
public void add(MailboxSession session, Mailbox mailbox, MailboxMessage message) throws MailboxException {
  try {
    LOGGER.info("Indexing mailbox {}-{} of user {} on message {}",
        mailbox.getName(),
        mailbox.getMailboxId(),
        session.getUser().getUserName(),
        message.getUid());
    elasticSearchIndexer.index(indexIdFor(mailbox, message.getUid()), messageToElasticSearchJson.convertToJson(message, ImmutableList.of(session.getUser())));
  } catch (Exception e) {
    try {
      LOGGER.warn("Indexing mailbox {}-{} of user {} on message {} without attachments ",
          mailbox.getName(),
          mailbox.getMailboxId().serialize(),
          session.getUser().getUserName(),
          message.getUid(),
          e);
      elasticSearchIndexer.index(indexIdFor(mailbox, message.getUid()), messageToElasticSearchJson.convertToJsonWithoutAttachment(message, ImmutableList.of(session.getUser())));
    } catch (JsonProcessingException e1) {
      LOGGER.error("Error when indexing mailbox {}-{} of user {} on message {} without its attachment",
          mailbox.getName(),
          mailbox.getMailboxId().serialize(),
          session.getUser().getUserName(),
          message.getUid(),
          e1);
    }
  }
}

org.apache.james.backends.esElasticSearchIndexerindex

Popular methods of ElasticSearchIndexer

  • <init>
  • delete
  • deleteAllMatchingQuery
  • update
  • checkArgument

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now