com.gilt.opm

OpmQueryResult

class OpmQueryResult[T <: OpmObject] extends AnyRef

This class exposes the results of an OPM query. It can be chained to further refine the query.

Because OPM is constructed on the fly and can vary based the time you are looking for, it is difficult to build a query directly on top of the underlying datastore. I guess this can vary based on implementation (depending on the storage of diffs and whether or not those diffs include all properties of the object), but in the current implementation there is no guarantee that two properties will be in the same record. As such, there is no way to query something like [foo = 'bar' and baz = 'bat'] on a series of value and diff records, so we can effectively only query by one property at a time. This class does that with Streams and filters, so the results are lazy-loaded as you ask for them.

Because it is difficult to "know" the value of an object's property until the OPM object is loaded from the datastore, the methodology here is to query the datastore in the most limiting way possible (i.e. pull all records for which the property matched the value at any point in time and not necessarily "right now"), then load those objects and filter out any objects that do not currently match.

For the best efficiency, it is recommended to 'find' by your most limiting query first, so as to limit the results being processed. Also, it is not recommended to call obj.all.length (or a sort), since that forces the stream to be completely processed and negates any advantages of the lazy-loaded stream.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OpmQueryResult
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OpmQueryResult(all: Stream[T], valueTranslator: Option[(String, Any) ⇒ Any] = scala.None)(implicit arg0: Manifest[T])

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val all: Stream[T]

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. def limit(n: Int): OpmQueryResult[T]

    Limit the current results to n records.

    Limit the current results to n records. This can be chained for further filtering.

    returns

  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. def search(query: OpmPropertyQuery, matchInverse: Boolean): OpmQueryResult[T]

    Use this to search within the current resultset if you already have the query object.

    Use this to search within the current resultset if you already have the query object. This is useful if you need to collect the query, do something with it, and then pass it into an existing resultset (i.e. in OpmMongoStorage.search).

    Returns another result object, which can be further chained.

  20. def search[V](v: (T) ⇒ V): OpmSearcherHelper[T, V]

    Use this to search within the current resultset to further filter the query.

    Use this to search within the current resultset to further filter the query. Complex queries can be chained together like this: obj.search(_.property1).equals("foo").search(_.property2).equals("bar")...

    Returns another result object, which can be further chained.

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped