-
Notifications
You must be signed in to change notification settings - Fork 48
Feature Request: Include ID in results() array (optionally?) #24
Comments
To answer this one. You can call Unfortunately, there would be no way to use |
No, I get that... but why not an associative array where the keys are the IDs? I would think it’s commonly desired to have the id available, but so much slower and resource intensive to have to iterate through the objects and gather the IDs and then flatten to an array and insert the the IDs. Alternatively, I figured I could store the ID inside the document, but that seemed silly since the file name is already the ID. I guess that’s what I’ll do though for now. |
@instanttim Actually, you do make a good point on the associative array keys. It would make sense to have the keys as document ids this way they can always be referenced. I'm going to add that to the list. |
…ange indexes from chronological integers to document Id. Adding the ID within the array key allows a reference the original document.
…nts() change indexes from chronological integers to document Id. Adding the ID within the array key allows a reference the original document." This reverts commit 1e413bb.
Guess it didn't work? |
@instanttim It did, unfortunately, it didn't work with php 5.6, so I would need more testing into why the test failed. I currently am on a few other projects, the code is there if you want to take a look and see if anything stands out. |
I had the same problem, there is an easy workaround. Just store the id as a field in the itemdata right after you create the item, then it will be available in the results() array.
|
When you use resultDocuments() you can get use getID() to get the ID. But when you use the lighter-weight and default results() there seems to be no way to also return the ID with the records in the array.
The text was updated successfully, but these errors were encountered: