actionml / template-scala-parallel-universal-recommendation

30 stars 21 forks source link

Can't get dateRange to work #8

Closed rbjarnason closed 8 years ago

rbjarnason commented 8 years ago

I have great recommendations coming through and fields with biases work as expected in queries, but I can't get dateRange to work. Any hints would be welcome.

Here is my query - it works fine if I skip the dateRange. I've also tried using the date as name for the dateRange but nothing works I always get 0 results back:

{
  user: user.id,
  fields: [
    {
      name: "domain",
      values: [1],
      bias: -1
    },
    {
      name: "status",
      values: ["published"],
      bias: -1
    }
  ],
  dateRange: {
    name: "availableDate",
    before: "2016-02-15T23:04:45.000Z",
    after: "2012-02-15T23:04:45.000Z"
  }
}

Here is an example from getEvents()

{
    eventId: 'ABuJ1tICnBCr697Y1ZFozAAAATzgGkrIoqAO6pn0kWA',
    event: '$set',
    entityType: 'item',
    entityId: '2919',
    properties: 
     { community: [Object],
       availableDate: '2013-02-15T23:04:45.000Z',
       domain: [Object],
       groupAccess: [Object],
       date: '2013-02-15T23:04:45.000Z',
       status: [Object],
       expireDate: '3016-04-01T04:20:00.000Z',
       communityAccess: [Object],
       official_status: [Object],
       category: [Object],
       group: [Object] },
    eventTime: '2013-02-15T23:04:45.000Z',
    creationTime: '2016-03-05T13:06:13.012Z'
},
pferrel commented 8 years ago

You are using both modes of data queries and the available/expire will take precedence since they work without anything in the query. First decide which one of the mode you want and remove config to the unneeded one from engne.json.

https://github.com/actionml/template-scala-parallel-universal-recommendation/tree/v0.3.0#dates

In the mode of date queries where the range is in the query as you are using--#2 in the list--you expect there to be a named property in all items that contain a date, which must be between the dates in the data range.

You must specify this as "dateName": "dateFieldName" in engine.json as described here: https://github.com/actionml/template-scala-parallel-universal-recommendation/tree/v0.3.0#complete-parameter-set.

rbjarnason commented 8 years ago

Thanks again @pferrel everything is works now :)