Package org.bedework.calfacade.indexing
Interface BwIndexer
- All Superinterfaces:
Serializable
- Author:
- douglm
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String[]static final String[]Used for fetching master + overridestatic final String[] -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release any rsources etc.voidCalled at the end of a batch of updates.org.bedework.util.misc.response.GetEntitiesResponse<BwAdminGroup>Fetch all groups.org.bedework.util.misc.response.GetEntitiesResponse<BwAdminGroup>fetchAdminGroups(String memberHref) Fetch all admin groups of which href is a member.Fetch all for the current principal.Fetch all for the current principal.Fetch all for the current principal.Find a category owned by the current user which has a named field which matches the value.fetchChildren(String href) Fetch children of the collection with the given href.fetchChildren(String href, boolean excludeTombstoned) Fetch children of the collection with the given href.fetchChildrenDeep(String href) Fetch children at any depth of the collection with the given href.org.bedework.util.misc.response.GetEntityResponse<BwCalendar>fetchCol(String val, int desiredAccess, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) Find a collection which has a named field which matches the value.fetchContact(String val, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) Find a contact owned by the current user which has a named field which matches the value.org.bedework.util.misc.response.GetEntityResponse<EventInfo>fetchEvent(String href) Href of event with possible anchor tag for recurrence id.org.bedework.util.misc.response.GetEntitiesResponse<EventInfo>fetchEvent(String colPath, String guid) Colpath and guid supplied.fetchEvents(String path, String lastmod, int lastmodSeq, int count) Return all or first count eventsfetchFilter(String href) Find a filter with the given href.fetchFilters(org.bedework.caldav.util.filter.FilterBase fb, int count) Return all or first count filtersorg.bedework.util.misc.response.GetEntitiesResponse<BwGroup<?>>fetchGroups(boolean admin) Fetch all groups.org.bedework.util.misc.response.GetEntitiesResponse<BwGroup<?>>fetchGroups(boolean admin, String memberHref) Fetch all groups of which href is a member.fetchLocation(String val, org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex... index) Find a location owned by the current user which has a named field which matches the value.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.fetchPreferences(String href) Find a preference owned by the given href.BwPrincipal<?>fetchPrincipal(String href) Find a principal by href.fetchResource(String href) Find a resource with the given href.fetchResourceContent(String href) Find a resource content with the given href.fetchResources(String path, String lastmod, int lastmodSeq, int count) Return all or first count resourcesorg.bedework.util.misc.response.GetEntitiesResponse<BwCategory>findCategories(org.bedework.caldav.util.filter.FilterBase filter, int from, int size) org.bedework.util.misc.response.GetEntitiesResponse<BwContact>findContacts(org.bedework.caldav.util.filter.FilterBase filter, int from, int size) org.bedework.util.misc.response.GetEntitiesResponse<BwLocation>findLocations(org.bedework.caldav.util.filter.FilterBase filter, int from, int size) voidflush()Flush any batched entities.List<org.bedework.util.indexing.ContextInfo>return the context info for the cluster.Get info on indexes maintained by servergetIndexStats(String indexName) booleangetReindexStatus(String indexName) getSearchResult(SearchResult sres, int offset, int num, int desiredAccess) Called to retrieve results after a search of the index.getSearchResult(SearchResult sres, BwIndexer.Position pos, int desiredAccess) Called to retrieve results after a search of the index.voidindexEntity(Object rec) Called to index a recordvoidindexEntity(Object rec, boolean waitForIt, boolean forTouch) Called to index a record with optional waitvoidFlag the end of a transaction - updates the updateTracker if any changes were made to the index.newIndex()create a new index for current doctype and start using it.Purge non-current indexes maintained by server.reindex()Indexes the current datafor the current docType into a new index.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) Called to find entries that match the search string.intSet alias on the given index - to make it the production index.voidsetBatchSize(int val) Set to > 1 to enable batchingvoidunindexContained(String colPath) Called to unindex entities in a collection.voidunindexEntity(String href) Called to unindex an entityvoidunindexEntity(BwEventProperty<?> val) Called to unindex an entityvoidunindexTombstoned(String docType, String href) Called to unindex a tombstoned entity.
-
Field Details
-
docTypeUnknown
- See Also:
-
docTypePrincipal
- See Also:
-
docTypePreferences
- See Also:
-
docTypeCollection
- See Also:
-
docTypeCategory
- See Also:
-
docTypeLocation
- See Also:
-
docTypeContact
- See Also:
-
docTypeFilter
- See Also:
-
docTypeEvent
- See Also:
-
docTypeResource
- See Also:
-
docTypeResourceContent
- See Also:
-
allDocTypes
-
masterDocTypes
-
overrideDocTypes
-
masterOverrideEventTypes
Used for fetching master + override
-
-
Method Details
-
close
void close()Release any rsources etc. -
getPublic
boolean getPublic()- Returns:
- true if this is a public indexer
-
markTransaction
Flag the end of a transaction - updates the updateTracker if any changes were made to the index.- Throws:
CalFacadeException- on error
-
currentChangeToken
- 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
- Parameters:
indexName- of index- Returns:
- current statistics
-
getIndexStats
- 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 stringrelevance- true for a relevance style queryfilter- parsed filtersort- list of fields to sort by - may be nulldefaultFilterContext- - see abovestart- - if non-null limit to this and afterend- - if non-null limit to before thispageSize- - 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 searchpos- - specify movement in result setdesiredAccess- 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 searchoffset- from first recordnum- number of entriesdesiredAccess- to the entities- Returns:
- list of results - possibly empty - never null.
- Throws:
CalFacadeException- on error
-
unindexTombstoned
Called to unindex a tombstoned entity.- Parameters:
docType- type of documenthref- of entity to delete- Throws:
CalFacadeException- on error
-
unindexContained
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
Called to unindex an entity- Parameters:
val- an event property- Throws:
CalFacadeException- on error
-
unindexEntity
Called to unindex an entity- Parameters:
href- the entities href- Throws:
CalFacadeException- on error
-
indexEntity
Called to index a record- Parameters:
rec- an indexable object- Throws:
CalFacadeException- on error
-
indexEntity
Called to index a record with optional wait- Parameters:
rec- an indexable objectwaitForIt- true if we wait for it to appear in the indexforTouch- 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
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
Purge non-current indexes maintained by server.- Returns:
- names of indexes removed.
- Throws:
CalFacadeException- on error
-
setAlias
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
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 collectionguid- 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 eventslastmod- - if non-null use for sync checklastmodSeq- - if lastmod non-null use for sync checkcount- - <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 valueindex- e.g. UID or CN, VALUE- Returns:
- null or category object
- Throws:
CalFacadeException- on error
-
fetchAllCats
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 valueindex- e.g. HREF, UID or CN, VALUE- Returns:
- response with status and possible collection object
- Throws:
CalFacadeException- on error
-
fetchChildren
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
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
Find a principal by href.- Parameters:
href- - of principal- Returns:
- null or BwPrincipal object
- Throws:
CalFacadeException- on error
-
fetchGroups
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 groupsmemberHref- - 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
Find a preference owned by the given href.- Parameters:
href- - of owner principal- Returns:
- null or contact object
- Throws:
CalFacadeException- on error
-
fetchFilter
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 filtercount- - <0 for all- Returns:
- filter for owner
- Throws:
CalFacadeException- on error
-
fetchResource
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 resourceslastmod- - if non-null use for sync checklastmodSeq- - if lastmod non-null use for sync checkcount- - <0 for all- Returns:
- resources for owner
- Throws:
CalFacadeException- on error
-
fetchResourceContent
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 valueindex- e.g. UID or CN, VALUE- Returns:
- null or contact object
- Throws:
CalFacadeException- on error
-
fetchAllContacts
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- expressionfrom- start for resultsize- 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 valueindex- 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 fieldval- - 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- expressionfrom- start for resultsize- max number- Returns:
- status and locations
-
fetchAllLocations
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- expressionfrom- start for resultsize- max number- Returns:
- status and categories
-