title: How do I correctly compare Options members in Slick?
body: <p>I'm doing things with Addresses, and the member <strong>subpremise</strong>(apartment/condo #) causes retrieves to miss.  I also have concerns about subpremise being a part of my unique index constraint, given it can be null.</p>
  
  <p>Failure filter:</p>
  
  <pre><code>tableQuery.filter(c=&gt; (c.longitude === r.longitude &amp;&amp; c.latitude === r.latitude) ||
          (c.streetNumber === r.streetNumber &amp;&amp; c.route === r.route &amp;&amp; c.subpremise === r.subpremise &amp;&amp; c.neighborhoodId === r.neighborhoodId))
  </code></pre>
  
  <p>Successful filter: (by removung subpremise)</p>
  
  <pre><code>tableQuery.filter(c=&gt; (c.longitude === r.longitude &amp;&amp; c.latitude === r.latitude) ||
              (c.streetNumber === r.streetNumber &amp;&amp; c.route === r.route &amp;&amp; c.neighborhoodId === r.neighborhoodId)) 
  </code></pre>
  
  <p>I've included the definitions below s.t. if there is another contributing factor that I've missed, hopefully it will be noticed.</p>
  
  <pre><code>case class Address(id:Option[Long],streetNumber:Short,route:String,subpremise:Option[String],neighborhoodId:Fk,latitude:Option[Double],longitude:Option[Double])
  
  class Addresses(tag: Tag) extends Table[Address](tag, "addresses") with Logging {
    def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
    def streetNumber = column[Short]("street_number")
    def route = column[String]("route",O.NotNull)
    def subpremise = column[Option[String]]("subpremise")
    def neighborhoodId = column[Long]("neighborhood",O.NotNull)
    def latitude = column[Option[Double]]("latitude")
    def longitude = column[Option[Double]]("longitude")
  
    //Constraints
    def idx = index("idx_streetnum_route_subpremise_neighborhood", (streetNumber,route,subpremise,neighborhoodId), unique = true)
    def gps = index("gps", (latitude,longitude), unique = true)
  
    //Foreign Key
    def neighborhood = foreignKey("NEIGHBORHOOD_FK", neighborhoodId, Neighborhoods.tableQuery)(_.id)
  
    def * = (id.?,streetNumber,route,subpremise,neighborhoodId,latitude,longitude) &lt;&gt; (Address.tupled,Address.unapply)
  }
  </code></pre>