Interface CommitIndex


public interface CommitIndex
Index to store meta data against commits. This interface serves to decouple commit indexing from storing metadata in an index.
  • Method Details

    • addCommit

      void addCommit(@Nonnull Commit commit, @Nonnull Repository repository)
      Associates the provided Commit with the specified Repository.
      Parameters:
      commit - the commit
      repository - the repository
    • addProperty

      boolean addProperty(@Nonnull String commitId, @Nonnull String key, @Nonnull String value)
      Stores a string commit property. If the property (name-value pair) already exists, calling this method will have no effect.
      Parameters:
      commitId - the commit ID
      key - the property key
      value - the property value
      Returns:
      true if the property was created in the database, false if it already existed.
      Since:
      8.13
    • findByProperty

      @Nonnull Page<IndexedCommit> findByProperty(@Nonnull String propertyKey, @Nonnull String propertyValue, boolean caseSensitive, @Nonnull PageRequest pageRequest)
      Retrieves all indexed commits that have a given property with a specified value.
      Parameters:
      propertyKey - the property key
      propertyValue - the property value
      caseSensitive - whether matches against value should be case-sensitive
      pageRequest - the page request
      Returns:
      a page of IndexedCommit commits that have the provided property. The results in the page are ordered by authorTimestamp descending
    • getCommit

      @Nullable IndexedCommit getCommit(@Nonnull String commitId)
      Retrieves the specified commit if it's been indexed.
      Parameters:
      commitId - the commit ID
      Returns:
      the IndexedCommit, or null if the specified commit has not been indexed
    • getProperties

      @Nonnull PropertyMap getProperties(@Nonnull String commitId, @Nonnull Iterable<String> propertyKeys)
      Retrieves a property map containing all properties stored against the given commit, matching propertyKeys. The value of all the properties is of type Set<String>.
      Parameters:
      commitId - the commit id
      propertyKeys - the property keys to retrieve
      Returns:
      properties for commit with commitId, matching propertyKeys. Can be empty, but not null.
    • getProperties

      @Nonnull Map<String,PropertyMap> getProperties(@Nonnull Iterable<String> commitIds, @Nonnull Iterable<String> propertyKeys)
      Retrieves a properties for each of the specified commits, matching the provided propertyKeys. The value of all the properties is of type Set<String>.
      Parameters:
      commitIds - commit IDs
      propertyKeys - the property keys to retrieve for each commit
      Returns:
      properties for each commit in commitIds, matching propertyKeys, mapped by commit IDs. Can be empty, but not null.
    • isIndexed

      boolean isIndexed(@Nonnull String commitId, @Nonnull Repository repository)
      Parameters:
      commitId - the commit ID
      repository - the repository
      Returns:
      true if the provided commit was indexed in the specified repository
    • removeCommit

      void removeCommit(@Nonnull String commitId, @Nonnull Repository repository)
      Removes the association between the specified commit and repository in the index. If the specified repository was the only association for the commit, it will be fully removed from the index. Otherwise, the commit may still appear in the index if it is available in other repositories.
      Parameters:
      commitId - the ID of the commit to remove from the index
      repository - the repository to remove the commit's association for
    • removeProperty

      void removeProperty(@Nonnull String commitId, @Nonnull String key, @Nonnull String value)
      Removes a commit property.
      Parameters:
      commitId - the commit ID
      key - the property key
      value - the property value
    • search

      @Nonnull Page<IndexedCommit> search(@Nonnull IndexSearchRequest searchRequest, @Nonnull PageRequest pageRequest)
      Searches the index for any matching commits.
      Parameters:
      searchRequest - the criteria to match
      pageRequest - a pageRequest to delimit the search
      Returns:
      a page of IndexedCommits, possibly empty if no indexed commits match
    • searchRepositoryCommits

      @Nonnull Page<MinimalRepositoryCommit> searchRepositoryCommits(@Nonnull IndexSearchRequest indexSearchRequest, @Nonnull PageRequest pageRequest) throws IllegalArgumentException
      Search the index for any commits matching the provided search request. Only commits in repositories that the current user has access to will be returned. The provided filter should be at least 7 characters long.
      Parameters:
      indexSearchRequest - the search request
      pageRequest - the page request
      Returns:
      a page of commits that match the criteria and that are in repositories the current user has access to
      Throws:
      IllegalArgumentException - if criteria.getFilter() is less than 7 characters
      Since:
      5.8