Interface BwIndexer

All Superinterfaces:
Serializable

public interface BwIndexer extends Serializable
Author:
douglm
  • Field Details

  • Method Details

    • close

      void close()
      Release any rsources etc.
    • getPublic

      boolean getPublic()
      Returns:
      true if this is a public indexer
    • markTransaction

      void markTransaction() throws CalFacadeException
      Flag the end of a transaction - updates the updateTracker if any changes were made to the index.
      Throws:
      CalFacadeException - on error
    • currentChangeToken

      String currentChangeToken() throws CalFacadeException
      Returns:
      a token based on the update tracker value.
      Throws:
      CalFacadeException - on error
    • reindex

      ReindexResponse reindex()
      Indexes the current datafor the current docType into a new index. Will return a response indicating what happened. An immediate response with status processing indicates a process is already running.
      Returns:
      final statistics
    • getReindexStatus

      ReindexResponse getReindexStatus(String indexName)
      Parameters:
      indexName - of index
      Returns:
      current statistics
    • getIndexStats

      IndexStatsResponse getIndexStats(String indexName)
      Parameters:
      indexName - of index
      Returns:
      current statistics
    • search

      SearchResult search(String query, boolean relevance, org.bedework.caldav.util.filter.FilterBase filter, List<SortTerm> sort, org.bedework.caldav.util.filter.FilterBase defaultFilterContext, String start, String end, int pageSize, BwIndexer.DeletedState deletedState, RecurringRetrievalMode recurRetrieval) throws CalFacadeException
      Called to find entries that match the search string. This string may be a simple sequence of keywords or some sort of query the syntax of which is determined by the underlying implementation.

      defaultFilterContext is a temporary fix until the client is fully upgraded. This is applied as the context for the search if present and no other context is provided. For example, in the user client the default context includes all the user calendars, not the inbox. If no path is selected we apply the default. If a path IS selected we do not apply the default. This allows, for instance, selection of the inbox.

      Parameters:
      query - Query string
      relevance - true for a relevance style query
      filter - parsed filter
      sort - list of fields to sort by - may be null
      defaultFilterContext - - see above
      start - - if non-null limit to this and after
      end - - if non-null limit to before this
      pageSize - - stored in the search result for future calls.
      recurRetrieval - How recurring event is returned.
      Returns:
      SearchResult - never null
      Throws:
      CalFacadeException - on error
    • getSearchResult

      List<SearchResultEntry> getSearchResult(SearchResult sres, BwIndexer.Position pos, int desiredAccess) throws CalFacadeException
      Called to retrieve results after a search of the index. Updates the current search result.
      Parameters:
      sres - result of previous search
      pos - - specify movement in result set
      desiredAccess - to the entities
      Throws:
      CalFacadeException - on error
    • getSearchResult

      List<SearchResultEntry> getSearchResult(SearchResult sres, int offset, int num, int desiredAccess) throws CalFacadeException
      Called to retrieve results after a search of the index. Updates the SearchResult object
      Parameters:
      sres - result of previous search
      offset - from first record
      num - number of entries
      desiredAccess - to the entities
      Returns:
      list of results - possibly empty - never null.
      Throws:
      CalFacadeException - on error
    • unindexTombstoned

      void unindexTombstoned(String docType, String href) throws CalFacadeException
      Called to unindex a tombstoned entity.
      Parameters:
      docType - type of document
      href - of entity to delete
      Throws:
      CalFacadeException - on error
    • unindexContained

      void unindexContained(String colPath) throws CalFacadeException
      Called to unindex entities in a collection. This is used when deleting a collection. All entities should be tombstoned
      Parameters:
      colPath - of entities to delete
      Throws:
      CalFacadeException - on error
    • unindexEntity

      void unindexEntity(BwEventProperty<?> val) throws CalFacadeException
      Called to unindex an entity
      Parameters:
      val - an event property
      Throws:
      CalFacadeException - on error
    • unindexEntity

      void unindexEntity(String href) throws CalFacadeException
      Called to unindex an entity
      Parameters:
      href - the entities href
      Throws:
      CalFacadeException - on error
    • indexEntity

      void indexEntity(Object rec) throws CalFacadeException
      Called to index a record
      Parameters:
      rec - an indexable object
      Throws:
      CalFacadeException - on error
    • indexEntity

      void indexEntity(Object rec, boolean waitForIt, boolean forTouch) throws CalFacadeException
      Called to index a record with optional wait
      Parameters:
      rec - an indexable object
      waitForIt - true if we wait for it to appear in the index
      forTouch - true if we ignore versioning exceptions - will return null
      Throws:
      CalFacadeException - on error
    • setBatchSize

      void setBatchSize(int val)
      Set to > 1 to enable batching
      Parameters:
      val - batch size
    • endBwBatch

      void endBwBatch()
      Called at the end of a batch of updates.
    • flush

      void flush()
      Flush any batched entities.
    • getDocType

      String getDocType()
    • newIndex

      String newIndex() throws CalFacadeException
      create a new index for current doctype and start using it.
      Returns:
      name of created index.
      Throws:
      CalFacadeException - on error
    • getIndexInfo

      Get info on indexes maintained by server
      Returns:
      list of index info.
      Throws:
      CalFacadeException - on error
    • getContextInfo

      List<org.bedework.util.indexing.ContextInfo> getContextInfo()
      return the context info for the cluster. Somewhat opensearch specific
      Returns:
      possibly empty list.
    • purgeIndexes

      List<String> purgeIndexes() throws CalFacadeException
      Purge non-current indexes maintained by server.
      Returns:
      names of indexes removed.
      Throws:
      CalFacadeException - on error
    • setAlias

      int setAlias(String index) throws CalFacadeException
      Set alias on the given index - to make it the production index.
      Parameters:
      index - name of index to be aliased
      Returns:
      0 for OK or HTTP status from indexer
      Throws:
      CalFacadeException - on error
    • fetchEvent

      org.bedework.util.misc.response.GetEntityResponse<EventInfo> fetchEvent(String href)
      Href of event with possible anchor tag for recurrence id. This returns the master + overrides if there is no recurrence id or a fully populated instance otherwise.
      Parameters:
      href - of event
      Returns:
      entity is EventInfo with overrides if present
    • fetchEvent

      org.bedework.util.misc.response.GetEntitiesResponse<EventInfo> fetchEvent(String colPath, String guid)
      Colpath and guid supplied. May be multiple results for inbox
      Parameters:
      colPath - to event collection
      guid - of event
      Returns:
      entities are EventInfo objects with overrides if present
    • fetchEvents

      List<EventInfo> fetchEvents(String path, String lastmod, int lastmodSeq, int count) throws CalFacadeException
      Return all or first count events
      Parameters:
      path - - to events
      lastmod - - if non-null use for sync check
      lastmodSeq - - if lastmod non-null use for sync check
      count - - <0 for all
      Returns:
      events for owner
      Throws:
      CalFacadeException - on error
    • fetchCat

      BwCategory fetchCat(String val, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) throws CalFacadeException
      Find a category owned by the current user which has a named field which matches the value.
      Parameters:
      val - - expected full value
      index - e.g. UID or CN, VALUE
      Returns:
      null or category object
      Throws:
      CalFacadeException - on error
    • fetchAllCats

      List<BwCategory> fetchAllCats() throws CalFacadeException
      Fetch all for the current principal.
      Returns:
      possibly empty list
      Throws:
      CalFacadeException - on error on error
    • fetchCol

      org.bedework.util.misc.response.GetEntityResponse<BwCalendar> fetchCol(String val, int desiredAccess, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) throws CalFacadeException
      Find a collection which has a named field which matches the value.
      Parameters:
      val - - expected full value
      index - e.g. HREF, UID or CN, VALUE
      Returns:
      response with status and possible collection object
      Throws:
      CalFacadeException - on error
    • fetchChildren

      Collection<BwCalendar> fetchChildren(String href) throws CalFacadeException
      Fetch children of the collection with the given href. Tombstoned collections are excluded
      Parameters:
      href - of parent
      Returns:
      possibly empty list of children
      Throws:
      CalFacadeException - on error
    • fetchChildren

      Collection<BwCalendar> fetchChildren(String href, boolean excludeTombstoned) throws CalFacadeException
      Fetch children of the collection with the given href.
      Parameters:
      href - of parent
      Returns:
      possibly empty list of children
      Throws:
      CalFacadeException - on error
    • fetchChildrenDeep

      Collection<BwCalendar> fetchChildrenDeep(String href) throws CalFacadeException
      Fetch children at any depth of the collection with the given href.
      Parameters:
      href - of parent
      Returns:
      possibly empty list of children
      Throws:
      CalFacadeException - on error
    • fetchPrincipal

      BwPrincipal<?> fetchPrincipal(String href) throws CalFacadeException
      Find a principal by href.
      Parameters:
      href - - of principal
      Returns:
      null or BwPrincipal object
      Throws:
      CalFacadeException - on error
    • fetchGroups

      org.bedework.util.misc.response.GetEntitiesResponse<BwGroup<?>> fetchGroups(boolean admin)
      Fetch all groups.
      Parameters:
      admin - - true for admin groups
      Returns:
      status and List of groups
    • fetchAdminGroups

      org.bedework.util.misc.response.GetEntitiesResponse<BwAdminGroup> fetchAdminGroups()
      Fetch all groups.
      Returns:
      status and List of groups
    • fetchGroups

      org.bedework.util.misc.response.GetEntitiesResponse<BwGroup<?>> fetchGroups(boolean admin, String memberHref)
      Fetch all groups of which href is a member.
      Parameters:
      admin - - true for admin groups
      memberHref - - of member
      Returns:
      status and List of groups
    • fetchAdminGroups

      org.bedework.util.misc.response.GetEntitiesResponse<BwAdminGroup> fetchAdminGroups(String memberHref)
      Fetch all admin groups of which href is a member.
      Parameters:
      memberHref - - of member
      Returns:
      status and List of groups
    • fetchPreferences

      BwPreferences fetchPreferences(String href) throws CalFacadeException
      Find a preference owned by the given href.
      Parameters:
      href - - of owner principal
      Returns:
      null or contact object
      Throws:
      CalFacadeException - on error
    • fetchFilter

      BwFilterDef fetchFilter(String href) throws CalFacadeException
      Find a filter with the given href.
      Parameters:
      href - - of filter
      Returns:
      null or filter object
      Throws:
      CalFacadeException - on error
    • fetchFilters

      List<BwFilterDef> fetchFilters(org.bedework.caldav.util.filter.FilterBase fb, int count) throws CalFacadeException
      Return all or first count filters
      Parameters:
      fb - - possibly null filter
      count - - <0 for all
      Returns:
      filter for owner
      Throws:
      CalFacadeException - on error
    • fetchResource

      BwResource fetchResource(String href) throws CalFacadeException
      Find a resource with the given href.
      Parameters:
      href - - of resource
      Returns:
      null or resource object
      Throws:
      CalFacadeException - on error
    • fetchResources

      List<BwResource> fetchResources(String path, String lastmod, int lastmodSeq, int count) throws CalFacadeException
      Return all or first count resources
      Parameters:
      path - - to resources
      lastmod - - if non-null use for sync check
      lastmodSeq - - if lastmod non-null use for sync check
      count - - <0 for all
      Returns:
      resources for owner
      Throws:
      CalFacadeException - on error
    • fetchResourceContent

      BwResourceContent fetchResourceContent(String href) throws CalFacadeException
      Find a resource content with the given href.
      Parameters:
      href - - of resource content
      Returns:
      null or resource object
      Throws:
      CalFacadeException - on error
    • fetchContact

      BwContact fetchContact(String val, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) throws CalFacadeException
      Find a contact owned by the current user which has a named field which matches the value.
      Parameters:
      val - - expected full value
      index - e.g. UID or CN, VALUE
      Returns:
      null or contact object
      Throws:
      CalFacadeException - on error
    • fetchAllContacts

      List<BwContact> fetchAllContacts() throws CalFacadeException
      Fetch all for the current principal.
      Returns:
      possibly empty list
      Throws:
      CalFacadeException - on error
    • findContacts

      org.bedework.util.misc.response.GetEntitiesResponse<BwContact> findContacts(org.bedework.caldav.util.filter.FilterBase filter, int from, int size)
      Parameters:
      filter - expression
      from - start for result
      size - max number
      Returns:
      status and locations
    • fetchLocation

      BwLocation fetchLocation(String val, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) throws CalFacadeException
      Find a location owned by the current user which has a named field which matches the value.
      Parameters:
      val - - expected full value
      index - e.g. UID or CN, VALUE
      Returns:
      null or location object
      Throws:
      CalFacadeException - on error
    • fetchLocationByKey

      org.bedework.util.misc.response.GetEntityResponse<BwLocation> fetchLocationByKey(String name, String val)
      Find a location owned by the current user which has a named key field which matches the value.
      Parameters:
      name - - of key field
      val - - expected full value
      Returns:
      null or location object
    • findLocations

      org.bedework.util.misc.response.GetEntitiesResponse<BwLocation> findLocations(org.bedework.caldav.util.filter.FilterBase filter, int from, int size)
      Parameters:
      filter - expression
      from - start for result
      size - max number
      Returns:
      status and locations
    • fetchAllLocations

      List<BwLocation> fetchAllLocations() throws CalFacadeException
      Fetch all for the current principal.
      Returns:
      possibly empty list
      Throws:
      CalFacadeException - on error
    • findCategories

      org.bedework.util.misc.response.GetEntitiesResponse<BwCategory> findCategories(org.bedework.caldav.util.filter.FilterBase filter, int from, int size)
      Parameters:
      filter - expression
      from - start for result
      size - max number
      Returns:
      status and categories