LocalSearchService

com.google.appengine.api.prospectivesearch.dev

Class LocalSearchService

  • java.lang.Object
    • AbstractLocalRpcService
      • com.google.appengine.api.prospectivesearch.dev.LocalSearchService


  • public final class LocalSearchService
    extends AbstractLocalRpcService
    Local Prospective Search service using in-memory O(n) subscription management. Subscriptions are expired lazily, as the first operation in calls to match and listSubscriptions. Subscriptions are persisted to the datastore in the default namespace, stored in the entity type defined in ProspectiveSearchReservedKinds. About 100,000 20 byte query subscriptions can be stored. This constraint may change in future releases.

    Modifications to subscriptions will be persisted automatically. This behavior can be toggled with the AUTOCOMMIT_PROPERTY to allow for high performance for batches of state modifications.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String AUTOCOMMIT_PROPERTY
      This property controls whether the state of the local ProspectiveSearchService will automatically be persisted after modification.
      static java.lang.String PACKAGE
      The package name for this service.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getPackage() 
      void init(LocalServiceContext context, java.util.Map<java.lang.String,java.lang.String> properties) 
      ListSubscriptionsResponse listSubscriptions(Status status, ListSubscriptionsRequest request)
      Return a list of subscriptions encapsulated in ListSubscriptionsResponse that match the given ListSubscriptionsRequest constraints on subscription topic, id and expiry.
      ListTopicsResponse listTopics(Status status, ListTopicsRequest req)
      List all topics from a given offset to a given limit.
      MatchResponse match(Status status, MatchRequest request)
      Check the requested topic exists and then try matching the document against all subscriptions in the topic.
      SubscribeResponse subscribe(Status status, SubscribeRequest request)
      Add a subscription.
      UnsubscribeResponse unsubscribe(Status status, UnsubscribeRequest request)
      Remove the subscription matching the given UnsubscribeResponse's topic and id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • AUTOCOMMIT_PROPERTY

        public static final java.lang.String AUTOCOMMIT_PROPERTY
        This property controls whether the state of the local ProspectiveSearchService will automatically be persisted after modification. The default is true. If this property is set to false, no state will be persisted until it is again set to true and at least one API method is called.
        See Also:
        Constant Field Values
      • PACKAGE

        public static final java.lang.String PACKAGE
        The package name for this service.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LocalSearchService

        public LocalSearchService()
    • Method Detail

      • init

        public void init(LocalServiceContext context,
                         java.util.Map<java.lang.String,java.lang.String> properties)
      • getPackage

        public java.lang.String getPackage()
      • subscribe

        public SubscribeResponse subscribe(Status status,
                                           SubscribeRequest request)
        Add a subscription.
      • unsubscribe

        public UnsubscribeResponse unsubscribe(Status status,
                                               UnsubscribeRequest request)
        Remove the subscription matching the given UnsubscribeResponse's topic and id.
      • match

        public MatchResponse match(Status status,
                                   MatchRequest request)
        Check the requested topic exists and then try matching the document against all subscriptions in the topic. Matches cause a callback to be enqueued.

        If the query grammar changes, a stored subscription may become invalid. A log entry will be generated noting this, along with the subscription id, allowing for its removal.

      • listSubscriptions

        public ListSubscriptionsResponse listSubscriptions(Status status,
                                                           ListSubscriptionsRequest request)
        Return a list of subscriptions encapsulated in ListSubscriptionsResponse that match the given ListSubscriptionsRequest constraints on subscription topic, id and expiry.
      • listTopics

        public ListTopicsResponse listTopics(Status status,
                                             ListTopicsRequest req)
        List all topics from a given offset to a given limit. Topics will be returned in lexicographic order from the first or given start.