Per the recommendations of experts, we have switched some of our FVA fields to Computed Fields that use the getFieldValue() function. With queries, the performance is significantly slower using the Computed Fields vs. FVA; and by significant the performce changes from almost instant with FVAs to 10's of seconds for the Computed Fields.
What are the guidelines for using Computed Fields and getting as much performance as possible?
I have never heard of replacing FVAs with computed fields as you describe, so I would really love to know what your experts had to say. Can you elaborate please?
An FVA works from a straight relationship to an item (think "join"), whereas the computed field has to go get the item you require by field value (think "query"). So it makes sense that performance is worse. What type of fields are you querying?
I think that either you stay away from querying on such fields, or you go back to FVAs.
Thank you for you reply.
We are attempting to pull in fields from the segment item when in the context of a node item. Our original implementation utilized an FVA based on the "Contained By" relationship. Which works great for items that are contained directly by the segement. If there is a hierarchy however, this apporach no longer works. The proposed solution from the experts was for us to use a computed field with the getFieldValue(DocumentID(),"field we care about"); function instead of using an FVA.
So... "Going back to an FVA" is an option of sorts. Doing so puts back at our previous problem: How do we get fields contained in a segement when we're in a node item?
If we go back to an FVA, how do we get access to the segment fields from the node item?
You may want to consider a trigger that will:
You may have a number of fields you want to do this on, so a trigger becomes more efficient. A some examples would be:
One thing to note: The Document ID field is a little wierd. Grab the Document ID value from the parent of the delta bean. Don't try to use getNewFieldValue("Document ID").