test_class.declarator: rule = MockitoJUnit.rule()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public MockitoRule rule = MockitoJUnit.rule();
test_class.type: MockitoRule
test_class.var_name: rule
test_class.declarator: queue
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private IndexingQueue queue;
test_class.type: IndexingQueue
test_class.var_name: queue
test_class.declarator: tracker
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private IndexTracker tracker;
test_class.type: IndexTracker
test_class.var_name: tracker
test_class.declarator: observer
test_class.modifier: private
test_class.original_string: private ExternalIndexObserver observer;
test_class.type: ExternalIndexObserver
test_class.var_name: observer
test_class.declarator: commitContext = new SimpleCommitContext()
test_class.modifier: private
test_class.original_string: private CommitContext commitContext = new SimpleCommitContext();
test_class.type: CommitContext
test_class.var_name: commitContext
test_class.file: oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/ExternalIndexObserverTest.java
test_class.identifier: ExternalIndexObserverTest
test_case.body: @Test
      public void nonApplicableRule() throws Exception {
          Multimap<String, String> indexedPaths = HashMultimap.create();
          indexedPaths.put("/a", "/oak:index/foo");
  
          commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
          CommitInfo ci = newCommitInfo();
  
          //Rule is on nt:file but node if of type nt:base
          when(tracker.getIndexDefinition("/oak:index/foo")).thenReturn(createNRTIndex("nt:file"));
  
          NodeBuilder nb = INITIAL_CONTENT.builder();
          nb.child("a");
          observer.contentChanged(nb.getNodeState(), ci);
  
          verifyZeroInteractions(queue);
      }
test_case.class_method_signature: ExternalIndexObserverTest.nonApplicableRule()
test_case.full_signature: @Test public void nonApplicableRule()
test_case.identifier: nonApplicableRule
test_case.invocations: create put set newCommitInfo thenReturn when getIndexDefinition createNRTIndex builder child contentChanged getNodeState verifyZeroInteractions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void nonApplicableRule()
focal_class.declarator: log = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger log = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: indexingQueue
focal_class.modifier: private final
focal_class.original_string: private final IndexingQueue indexingQueue;
focal_class.type: IndexingQueue
focal_class.var_name: indexingQueue
focal_class.declarator: indexTracker
focal_class.modifier: private final
focal_class.original_string: private final IndexTracker indexTracker;
focal_class.type: IndexTracker
focal_class.var_name: indexTracker
focal_class.declarator: added
focal_class.modifier: private final
focal_class.original_string: private final MeterStats added;
focal_class.type: MeterStats
focal_class.var_name: added
focal_class.declarator: timer
focal_class.modifier: private final
focal_class.original_string: private final TimerStats timer;
focal_class.type: TimerStats
focal_class.var_name: timer
focal_class.file: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/ExternalIndexObserver.java
focal_class.identifier: ExternalIndexObserver
focal_class.interfaces: implements Observer, Filter
focal_class.class_method_signature: ExternalIndexObserver.ExternalIndexObserver(IndexingQueue indexingQueue, IndexTracker indexTracker, StatisticsProvider statisticsProvider)
focal_class.full_signature: public  ExternalIndexObserver(IndexingQueue indexingQueue, IndexTracker indexTracker, StatisticsProvider statisticsProvider)
focal_class.identifier: ExternalIndexObserver
focal_class.modifiers: public
focal_class.parameters: (IndexingQueue indexingQueue, IndexTracker indexTracker, StatisticsProvider statisticsProvider)
focal_class.signature:  ExternalIndexObserver(IndexingQueue indexingQueue, IndexTracker indexTracker, StatisticsProvider statisticsProvider)
focal_class.class_method_signature: ExternalIndexObserver.excludes(@NotNull NodeState root, @NotNull CommitInfo info)
focal_class.full_signature: @Override public boolean excludes(@NotNull NodeState root, @NotNull CommitInfo info)
focal_class.identifier: excludes
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull NodeState root, @NotNull CommitInfo info)
focal_class.return: boolean
focal_class.signature: boolean excludes(@NotNull NodeState root, @NotNull CommitInfo info)
focal_class.class_method_signature: ExternalIndexObserver.contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)
focal_class.full_signature: @Override public void contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)
focal_class.identifier: contentChanged
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull NodeState after, @NotNull CommitInfo info)
focal_class.return: void
focal_class.signature: void contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)
focal_method.body: @Override
      public void contentChanged(@NotNull NodeState after, @NotNull CommitInfo info) {
          //Only interested in external changes
          if (excludes(after, info)) {
              return;
          }
  
          CommitContext commitContext = (CommitContext) info.getInfo().get(CommitContext.NAME);
          IndexedPaths indexedPaths = (IndexedPaths) commitContext.get(LuceneDocumentHolder.NAME);
  
          commitContext.remove(LuceneDocumentHolder.NAME);
  
          log.trace("Received indexed paths {}", indexedPaths);
  
          int droppedCount = 0;
          int indexedCount = 0;
          TimerStats.Context ctx = timer.time();
          Set<String> indexPaths = Sets.newHashSet();
          for (IndexedPathInfo indexData : indexedPaths) {
              String path = indexData.getPath();
              NodeState indexedNode = null;
              for (String indexPath : indexData.getIndexPaths()) {
                  IndexDefinition defn = indexTracker.getIndexDefinition(indexPath);
  
                  //Only update those indexes which are in use in "this" cluster node
                  //i.e. for which IndexDefinition is being tracked by IndexTracker
                  //This would avoid wasted effort for those cases where index is updated
                  //but not used locally
                  if (defn == null) {
                      continue;
                  }
  
                  //Lazily initialize indexedNode
                  if (indexedNode == null) {
                      indexedNode = NodeStateUtils.getNode(after, path);
                  }
  
                  if (!indexedNode.exists()) {
                      continue;
                  }
  
                  IndexDefinition.IndexingRule indexingRule = defn.getApplicableIndexingRule(indexedNode);
  
                  if (indexingRule == null) {
                      log.debug("No indexingRule found for path {} for index {}", path, indexPath);
                      continue;
                  }
                  indexPaths.add(indexPath);
                  try {
                      Document doc = new LuceneDocumentMaker(defn, indexingRule, path).makeDocument(indexedNode);
  
                      if (doc != null) {
                          if (indexingQueue.add(LuceneDoc.forUpdate(indexPath, path, doc))) {
                              indexedCount++;
                          } else {
                              droppedCount++;
                          }
                      }
                  } catch (Exception e) {
                      log.warn("Ignoring making LuceneDocument for path {} for index {} due to exception", path, indexPath, e);
                  }
              }
          }
          if (droppedCount > 0) {
              log.warn("Dropped [{}] docs from indexing as queue is full", droppedCount);
          }
          added.mark(indexedCount);
          ctx.stop();
          log.debug("Added {} documents for {} indexes from external changes", indexedCount, indexPaths.size());
      }
focal_method.class_method_signature: ExternalIndexObserver.contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)
focal_method.full_signature: @Override public void contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)
focal_method.identifier: contentChanged
focal_method.invocations: excludes get getInfo get remove trace time newHashSet getPath getIndexPaths getIndexDefinition getNode exists getApplicableIndexingRule debug add makeDocument add forUpdate warn warn mark stop debug size
focal_method.modifiers: @Override public
focal_method.parameters: (@NotNull NodeState after, @NotNull CommitInfo info)
focal_method.return: void
focal_method.signature: void contentChanged(@NotNull NodeState after, @NotNull CommitInfo info)