Пример #1
0
 public static RelationshipOutput ForExistingEntityOrNull(GraphDatabaseService db, ScoreEntityIterator.ScoreEntry result)
 {
     try
     {
         return(new RelationshipOutput(Db.getRelationshipById(result.EntityId()), result.Score()));
     }
     catch (NotFoundException)
     {
         // This relationship was most likely deleted by a concurrent transaction, so we just ignore it.
         return(null);
     }
 }
Пример #2
0
        private static void AssertQueryResultsMatchInOrder(ScoreEntityIterator result, long[] ids)
        {
            int   num   = 0;
            float score = float.MaxValue;

            while (result.MoveNext())
            {
                ScoreEntityIterator.ScoreEntry scoredResult = result.Current;
                long  nextId    = scoredResult.EntityId();
                float nextScore = scoredResult.Score();
                assertThat(nextScore, lessThanOrEqualTo(score));
                score = nextScore;
                assertEquals(format("Result returned node id %d, expected %d", nextId, ids[num]), ids[num], nextId);
                num++;
            }
            assertEquals("Number of results differ from expected", ids.Length, num);
        }