FatFractal customer forums



Author Topic: Database Query Result narrowed to 0  (Read 2348 times)

ios@ymc.ch

  • Newbie
  • *
  • Posts: 5
    • View Profile
Database Query Result narrowed to 0
« on: November 22, 2013, 09:25:52 AM »
Hi, i wanted to fetch Users which match the following query:

ff.getArrayFromUri("/FFUser/(facebookId contains_any '" + friendsIdArray.join(" ") +  "')");

where i supply a list of facebook user ids and want to get an array of the corresponding FFUsers back.
Works good so far, but the result is narrowed to 0 with a debug output like this:
"Database result count 4 narrowed to 0 for query contains_any facebookId ..."
Is there a way to prevent this narrowing, or is this the wrong way to do this?

Thanks,
André

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Database Query Result narrowed to 0
« Reply #1 on: November 25, 2013, 11:10:57 AM »
Hi Andre,

That's odd - let me look into it and I'll get back to you as soon as I can

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Database Query Result narrowed to 0
« Reply #2 on: November 25, 2013, 11:26:09 AM »
ah, OK

there's no field called 'facebookId' in the FFUser object-type (unless you've added one, which I don't think you have)

Also, contains_any and contains_all are intended for textual term search, so almost certainly will not match on ids like this

If you need to search by facebookId, I'd suggest you do the following:
(1) Extend FFUser so it includes a facebookId
(2) Update the FFUser objects setting the facebookId field (a good time to do this is probably upon login or registration)
(3) Generate query as a big set of 'or' clauses rather than using contains_any

Cheers

- Gary

ios@ymc.ch

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Database Query Result narrowed to 0
« Reply #3 on: November 25, 2013, 12:21:18 PM »
Hi Gary,

thanks for the reply. I did add the facebookId field before. And what confused me most was the debug output which stated exactly how many entries it should have returned:
"Database result count 4 narrowed to 0 for query contains_any facebookId ..."
--> where it should have returned 4 matching rows.
I ended up doing it like you suggested using "eq" and joining with "or" which works like a charm.
Still i wonder what the narrowing means.

Thanks again,
André

ios@ymc.ch

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Database Query Result narrowed to 0
« Reply #4 on: November 25, 2013, 12:30:00 PM »
off course a good explanation would be it just ignores values only consisting of numbers in a later part of the fetch

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Database Query Result narrowed to 0
« Reply #5 on: November 26, 2013, 09:19:24 AM »
Hey Andre,

Glad your query is working OK now.

Send me an email (gary at fatfractal dot com) with your domain and application name and I'll try to replicate exactly but it certainly looks like it's to do with the facebookIds not being searchable as 'textual' terms. (contains_all and contains_any are more intended for free-text search - for example of blog posts or whatever - eg find me all messages containing all of the words 'london mayor boris')

Cheers

- Gary

 

Copyright © FatFractal customer forums