Class Result<T>

  • Type Parameters:
    T - Parameter Type
    Direct Known Subclasses:
    ResultDefault, ResultError

    public abstract class Result<T>
    extends java.lang.Object
    Abstract class for Result
    • Field Detail

      • RESULT_FIELD

        public static final java.lang.String RESULT_FIELD
        Field containing the full documents result as an array of document
        See Also:
        Constant Field Values
      • IDLIST

        public static final java.lang.String IDLIST
        Current Units in the result
        See Also:
        Constant Field Values
      • currentIds

        protected java.util.List<java.lang.String> currentIds
        Current Ids in the result
      • scores

        protected java.util.List<java.lang.Float> scores
        Current Ids in the result
      • nbResult

        protected long nbResult
        Number of result (might be different on update/delete than currentUnits)
      • total

        protected long total
        Total aproximated results out of limit
      • finalResult

        protected java.util.List<T> finalResult
        The final Result part
      • facetResult

        protected java.util.List<FacetResult> facetResult
        The FacetResult list
      • scrollId

        protected java.lang.String scrollId
        The scrollId
    • Constructor Detail

      • Result

        public Result​(BuilderToken.FILTERARGS type)
        Constructor for empty result
        Parameters:
        type - of filter
      • Result

        public Result​(BuilderToken.FILTERARGS type,
                      java.util.Collection<java.lang.String> collection)
        Constructor from a set, setting the nbResult to the size of Set
        Parameters:
        type - of filter
        collection - the set of working collection
    • Method Detail

      • clear

        public Result<T> clear()
        Clear the Result
        Returns:
        this
      • putFrom

        public Result<T> putFrom​(Result<T> from)
        Put from argument
        Parameters:
        from - the Result for creating another
        Returns:
        Result created
      • isError

        public boolean isError()
        Returns:
        True if this result is in error status (list containing error status)
      • getCurrentIds

        public java.util.List<java.lang.String> getCurrentIds()
        Returns:
        the current Ids
      • getCurrentScores

        public java.util.List<java.lang.Float> getCurrentScores()
        Returns:
        the current scores
      • addId

        public Result<T> addId​(java.lang.String id,
                               float score)
        Ad one Id to CurrentIds
        Parameters:
        id - the id as String adding to current result
        score - the associated score
        Returns:
        this
      • setScrollId

        public Result<T> setScrollId​(java.lang.String scrollId)
        Add ScrollId to Result
        Parameters:
        scrollId - the scrollid as String adding to current result
        Returns:
        this
      • getScrollId

        public java.lang.String getScrollId()
        Return ScrollId of Result
        Returns:
        ScrollId
      • getNbResult

        public final long getNbResult()
        Returns:
        the nbResult
      • setUpdatedResult

        public final Result<T> setUpdatedResult​(long nb)
        Parameters:
        nb - the number of updated elements
        Returns:
        this
      • getTotal

        public long getTotal()
        Returns:
        the approximative total of responses possible, out of limit
      • setTotal

        public Result<T> setTotal​(long total)
        Parameters:
        total - the approximative total of responses possible, out of limit
        Returns:
        this
      • getFinal

        public java.util.List<T> getFinal()
        Returns:
        the final Result
      • getFacet

        public java.util.List<FacetResult> getFacet()
        Returns:
        the list of FacetResult
      • addFinal

        public Result<T> addFinal​(T document)
        Add one document into final result
        Parameters:
        document - of type MetaDataDocument adding to result
      • setFinal

        public void setFinal​(org.bson.conversions.Bson projection)
        Build the array of result
        Parameters:
        projection - the project of document
      • addFacetResult

        public void addFacetResult​(FacetResult facetResult)
        Add a FacetResult
        Parameters:
        facetResult - facetResult
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasFinalResult

        public boolean hasFinalResult()
        Returns:
        boolean check if exist finalResult part