test_class.declarator: root = INITIAL_CONTENT
test_class.modifier: private
test_class.original_string: private NodeState root = INITIAL_CONTENT;
test_class.type: NodeState
test_class.var_name: root
test_class.declarator: builder = root.builder()
test_class.modifier: private
test_class.original_string: private NodeBuilder builder = root.builder();
test_class.type: NodeBuilder
test_class.var_name: builder
test_class.declarator: tracker = new IndexTracker()
test_class.modifier: private
test_class.original_string: private IndexTracker tracker = new IndexTracker();
test_class.type: IndexTracker
test_class.var_name: tracker
test_class.declarator: indexPath  = "/oak:index/foo"
test_class.modifier: private
test_class.original_string: private String indexPath  = "/oak:index/foo";
test_class.type: String
test_class.var_name: indexPath
test_class.declarator: defnb = new LuceneIndexDefinitionBuilder(child(builder, indexPath))
test_class.modifier: private
test_class.original_string: private LuceneIndexDefinitionBuilder defnb = new LuceneIndexDefinitionBuilder(child(builder, indexPath));
test_class.type: LuceneIndexDefinitionBuilder
test_class.var_name: defnb
test_class.declarator: query = new LuceneIndexPropertyQuery(tracker, indexPath)
test_class.modifier: private
test_class.original_string: private LuceneIndexPropertyQuery query = new LuceneIndexPropertyQuery(tracker, indexPath);
test_class.type: LuceneIndexPropertyQuery
test_class.var_name: query
test_class.file: oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/LuceneIndexPropertyQueryTest.java
test_class.identifier: LuceneIndexPropertyQueryTest
test_case.body: @Test
      public void simplePropertyIndex() throws Exception{
          defnb.noAsync();
          defnb.indexRule("nt:base").property("foo").propertyIndex();
  
          assertEquals(0,Iterables.size(query.getIndexedPaths("foo", "bar")));
  
          NodeState before = builder.getNodeState();
          builder.child("a").setProperty("foo", "bar");
          builder.child("b").setProperty("foo", "bar");
          NodeState after = builder.getNodeState();
  
          EditorHook hook = new EditorHook(new IndexUpdateProvider(new LuceneIndexEditorProvider()));
          NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
          tracker.update(indexed);
  
          assertThat(query.getIndexedPaths("foo", "bar"),
                  containsInAnyOrder("/a", "/b"));
      }
test_case.class_method_signature: LuceneIndexPropertyQueryTest.simplePropertyIndex()
test_case.full_signature: @Test public void simplePropertyIndex()
test_case.identifier: simplePropertyIndex
test_case.invocations: noAsync propertyIndex property indexRule assertEquals size getIndexedPaths getNodeState setProperty child setProperty child getNodeState processCommit update assertThat getIndexedPaths containsInAnyOrder
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void simplePropertyIndex()
focal_class.declarator: log = LoggerFactory.getLogger(LuceneIndexPropertyQuery.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(LuceneIndexPropertyQuery.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: tracker
focal_class.modifier: private final
focal_class.original_string: private final IndexTracker tracker;
focal_class.type: IndexTracker
focal_class.var_name: tracker
focal_class.declarator: indexPath
focal_class.modifier: private final
focal_class.original_string: private final String indexPath;
focal_class.type: String
focal_class.var_name: indexPath
focal_class.file: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/LuceneIndexPropertyQuery.java
focal_class.identifier: LuceneIndexPropertyQuery
focal_class.interfaces: implements PropertyQuery
focal_class.class_method_signature: LuceneIndexPropertyQuery.LuceneIndexPropertyQuery(IndexTracker tracker, String indexPath)
focal_class.full_signature: public  LuceneIndexPropertyQuery(IndexTracker tracker, String indexPath)
focal_class.identifier: LuceneIndexPropertyQuery
focal_class.modifiers: public
focal_class.parameters: (IndexTracker tracker, String indexPath)
focal_class.signature:  LuceneIndexPropertyQuery(IndexTracker tracker, String indexPath)
focal_class.class_method_signature: LuceneIndexPropertyQuery.getIndexedPaths(String propertyRelativePath, String value)
focal_class.full_signature: @Override public Iterable<String> getIndexedPaths(String propertyRelativePath, String value)
focal_class.identifier: getIndexedPaths
focal_class.modifiers: @Override public
focal_class.parameters: (String propertyRelativePath, String value)
focal_class.return: Iterable<String>
focal_class.signature: Iterable<String> getIndexedPaths(String propertyRelativePath, String value)
focal_method.body: @Override
      public Iterable<String> getIndexedPaths(String propertyRelativePath, String value) {
          List<String> indexPaths = new ArrayList<>(2);
          LuceneIndexNode indexNode = tracker.acquireIndexNode(indexPath);
          if (indexNode != null) {
              try {
                  TermQuery query = new TermQuery(new Term(propertyRelativePath, value));
                  //By design such query should not result in more than 1 result.
                  //So just use 10 as batch size
                  TopDocs docs = indexNode.getSearcher().search(query, 10);
  
                  IndexReader reader = indexNode.getSearcher().getIndexReader();
                  for (ScoreDoc d : docs.scoreDocs) {
                      PathStoredFieldVisitor visitor = new PathStoredFieldVisitor();
                      reader.document(d.doc, visitor);
                      indexPaths.add(visitor.getPath());
                  }
              } catch (IOException e) {
                  log.warn("Error occurred while checking index {} for unique value " +
                          "[{}] for [{}]", indexPath,value, propertyRelativePath, e);
              } finally {
                  indexNode.release();
              }
          }
          return indexPaths;
      }
focal_method.class_method_signature: LuceneIndexPropertyQuery.getIndexedPaths(String propertyRelativePath, String value)
focal_method.full_signature: @Override public Iterable<String> getIndexedPaths(String propertyRelativePath, String value)
focal_method.identifier: getIndexedPaths
focal_method.invocations: acquireIndexNode search getSearcher getIndexReader getSearcher document add getPath warn release
focal_method.modifiers: @Override public
focal_method.parameters: (String propertyRelativePath, String value)
focal_method.return: Iterable<String>
focal_method.signature: Iterable<String> getIndexedPaths(String propertyRelativePath, String value)