Given a SGraph for a result returned by the Search Service (using Java) what is the cleanest method of retrieving the value for one specific attribute, when there are many attributes with the same data type?
Eg. if a search is configured to return the following string attributes
... singleSearchRequest.getResultTransformationSpec().add("OTName"); singleSearchRequest.getResultTransformationSpec().add("OTDataID"); singleSearchRequest.getResultTransformationSpec().add("OTParentID"); ...Then when the first result returned iterated in this manner
SGraph sGraph = sResultPage.getItem.get(0); for (SNode sNode : sGraph.getN()) { for (Object sAttVal : sNode.getS()) { System.out.print(sAttVal + " (S)| "); } }the three values returned are not in the order they were added to the transformation spec. This makes sense as a List doesn't have any ordering, so I expected to find a method along the lines of
sNode.getS(String attributeName)
to allow me to do something like
SGraph sGraph = sResultPage.getItem.get(0); for (SNode sNode : sGraph.getN()) { System.out.print(sNode.getS("OTParentID") + " (S)| "); }but I can't find such a method, which tells me I'm thinking about this in the wrong way.
Any suggestions?