Component Implementation

API

Search Service

https://source.sakaiproject.org/svn/search/trunk/search-service/src/java/org/sakaiproject/search/SearchService.java

Alows a tool to search a list of contexts for a search term, which may include any of the fields in the index (content and/or metadata). The caller may request a start index in the search results and an end index.

A SearchList object is returned.

Administrative functions

  • registerFunction, registers a Sakai Event to be watched for updates
  • reload, is called when the Search Service is to reload its index
  • refreshInstance, causes the Search Service to inform the SearchIndexBuilder to refresh the index based on the list of documents indexed
  • rebuildInstance, causes the Search Service to tell the Search Index Builder to drop the index and rebuild completely from scratch
  • refreshSite, rebuildSite, do the same as above but only for one site.
  • getStatus, gets the status of the site
  • getNDocs, gets the number of documents in the index
  • getPendingDocs, gets the number of documents waiting to be indexed

Search Index Builder

https://source.sakaiproject.org/svn/search/trunk/search-service/src/java/org/sakaiproject/search/SearchIndexBuilder.java

  • addResource, adds a resource to index, using the Sakai Event
  • registerEntityContentProducer, registers an object providing EntityContentProducer capabilites with the IndexBuilder

Tool writers will probably not communicate with the Search Index Builder directly.

Entity Content Producer

https://source.sakaiproject.org/svn/search/trunk/search-service/src/java/org/sakaiproject/search/EntityContentProducer.java

An Entity Content Producer provides a mechanism by which the Search Index Builder can retrieve content from an EntityProducer. All Entities that want to be indexed must register an EntityContentProducer with the Search Index Builder, as well as registering the trigger events with the SearchService.

  • boolean isContentFromReader(Entity cr), should the content come from a reader or from a memory object.
  • Reader getContentReader(Entity cr), get the Reader for the content. This should be in a form that is suitable for use by the Search Index Builder. In the case of HTML it will be the text of the HTML page. In the case of a video stream it might be the audio content of the stream passed through a voice recognition engine and encoded as plain text.
  • String getContent(Entity cr), same as above, but as a string.
  • String getTitle(Entity cr), the title of the entity
  • String getUrl(Entity entity), a URL where the content can be retrieved from, in orriginal format (eg a video would play from this URL)
  • boolean matches(Reference ref), Does this EntityContentProducer own
  • boolean matches(Event event), same as above
    the Entity specified by the supplied reference
  • List getAllContent(), get a list of references (Strings) for all Entities owned by this EntityContentProducer
  • Integer getAction(Event event), based on the event, what action should be performed by the Search Index Builder.
  • String getTool() get the tool id that produced the content
  • String getSiteId(Reference ref); get the site ID.

This API will be in a state of flux for some time. There are currently 2 implementations for Messages and Wiki content at

https://source.sakaiproject.org/svn/search/trunk/search-service-impl/src/java/org/sakaiproject/search/component/adapter/MessageContentProducer.java

and

https://source.sakaiproject.org/svn/search/trunk/search-service-impl/src/java/org/sakaiproject/search/component/adapter/RWikiEntityContentProducer.java