Interface RelevancyModelApi

    • Field Detail

      • DEFAULT_RELEVANCY_MODEL_NAME

        static final java.lang.String DEFAULT_RELEVANCY_MODEL_NAME
        Name for default relevancy model.
        See Also:
        Constant Field Values
      • NOOP_RELEVANCY_MODEL_NAME

        static final java.lang.String NOOP_RELEVANCY_MODEL_NAME
        Name for relevancy model that does nothing.
        See Also:
        Constant Field Values
    • Method Detail

      • getFeatures

        java.lang.Iterable<RelevancyFeatureDef> getFeatures()
        Get all features.

        Order of returned features is undefined. Returned features should not be modified in any way.

      • addFeature

        void addFeature​(RelevancyFeatureDef feature)
        Throws:
        java.lang.IllegalArgumentException - if feature is null.
        java.lang.IllegalStateException - if feature with the same name already exists.
      • updateFeature

        void updateFeature​(RelevancyFeatureDef feature)
        Throws:
        java.lang.IllegalArgumentException - if feature is null.
        java.lang.IllegalStateException - if feature does not exist.
        java.lang.IllegalStateException - if the feature is statically defined.
      • deleteFeature

        void deleteFeature​(java.lang.String name)
        Delete a RelevancyFeatureDef with the specified name.
        Throws:
        java.lang.IllegalArgumentException - if name is null.
        java.lang.IllegalStateException - if the feature does not exist.
        java.lang.IllegalStateException - if the feature is statically defined.
      • isFeatureStatic

        boolean isFeatureStatic​(java.lang.String name)
        Returns true if feature is statically defined.

        Statically defined features cannot be updated or deleted.

      • getRelevancyModelNames

        java.util.List<java.lang.String> getRelevancyModelNames()
        Returns the names for all available relevancy models.
      • findRelevancyModel

        RelevancyModel findRelevancyModel​(java.lang.String... query)
        Find a relevancy model given a query.

        Relevancy model names are matched case insensitive.

        Returns the first available model specified in query.

        Query strings may include a version component in the format modelName#versionNumber to request a specific version. When version is not specified, the relevancy model returned will be the active version for the requested name.

        Returns null if no matching relevancy model found.

      • getRelevancyModel

        RelevancyModel getRelevancyModel​(java.lang.String name,
                                         long version)
        Get a specified version of a relevancy model.

        Returns null if relevancy model does not exist.

      • getRelevancyModels

        java.util.List<RelevancyModel> getRelevancyModels​(java.lang.String name)
        Get all versions available for a relevancy model.
      • addRelevancyModel

        long addRelevancyModel​(RelevancyModel model)
        Create a new relevancy model.

        Returns the version number for the newly created relevancy model.

      • updateRelevancyModel

        void updateRelevancyModel​(RelevancyModel model)
        Update an existing relevancy model.

        Fails if relevancy model does not exist, or if the relevancy model is active.

      • deleteRelevancyModel

        void deleteRelevancyModel​(java.lang.String name,
                                  long version)
        Delete a relevancy model.

        Fails if relevancy model does not exist, if the relevancy model's source is RelevancyModel.Source.STATIC or if the model is active.

      • trainRelevancyModel

        long trainRelevancyModel​(RelevancyModel model)
        Train a relevancy model according to signal data as specified by model

        Returns the version number for the newly created relevancy model.

        Relevancy model created will initially have a source of RelevancyModel.Source.TRAINING. Once training of the relevancy model is complete, the source will be updated to be RelevancyModel.Source.TRAINED.

      • testRelevancyModel

        RelevancyModel testRelevancyModel​(RelevancyModel model)
                                   throws java.io.IOException
        Test a relevancy model's accuracy according to stored signal data's expected output.

        Computing accuracy may take some time, depending on the volume of signal data being used.

        NOTE: model does not need to be a saved relevancy model. For instance, you can test the relevancy model prior to adding/updating a model with new weights.

        Parameters:
        model - A model to evaluate.
        Returns:
        A model with the accuracy populated according to specified signal data
        Throws:
        java.io.IOException
      • publishRelevancyModel

        void publishRelevancyModel​(java.lang.String name,
                                   long version)
        Publish a relevancy model.

        Published relevancy models will be used for matching partial relevancy model names in getRelevancyModel(String, long).

        Fails if relevancy model does not exist.

      • getRelevancyModelPublishTime

        long getRelevancyModelPublishTime​(java.lang.String name,
                                          long version)
        Returns the time the specified relevancy model was published.

        Returns 0 if the relevancy model is not the published model. Returns -1 if the model is the published model, but no time is associated with the publication.