setField Method

4 views
Skip to first unread message

BlackMage

unread,
Jan 27, 2012, 11:48:24 PM1/27/12
to MongoLantern
Code review that could lead to a possible problem. In the method
MongoLanternDocument::setField, there is the assigning of a variable
using $this->fieldsObj[$fieldObj->field] = $fieldObj;.

If a user assigns the values in a way such as:

$docObj->setField(MongoLanternField::Keyword('email', $doc['email']))
$docObj->setField(MongoLanternField::Text('email', $doc['email']))
$docObj->setField(MongoLanternField::UnIndexed('email',
$doc['email']))

The would end up overwritting.

Sougata Pal.

unread,
Jan 27, 2012, 11:53:10 PM1/27/12
to mongol...@googlegroups.com

Yes.  Multiple datatype for any specific index is not supported yet.

Thanks
Sougata Pal

- Sent via Google Android

ProdigyView

unread,
Jan 28, 2012, 12:03:05 AM1/28/12
to mongol...@googlegroups.com
What are your thoughts on this. Making the fieldObj and iterable collection, like a linked list. And then pulling the values from that linked lest and processing in other areas such as the Indexer::setDocument method.

Sougata Pal.

unread,
Jan 28, 2012, 12:17:49 AM1/28/12
to mongol...@googlegroups.com

This can be a good approach.  I will take that as an architectural consideration. 

Thanks
Sougata Pal

- Sent via Google Android

Reply all
Reply to author
Forward
0 new messages