Place the lentils in a small saucepan, cover with plenty of water, bring to a boil and cook for 12-15 minutes, or until the lentils have softened but still have a little bite. Drain into a colander.
Peel the onions and slice thinly. sprinkle with the flour and 1 tsp of the salt. using your hands gently mix until the onion is evenly coated with the flour. Heat the sunflower oil in a medium-size heavy-based saucepan over high heat. Test the oil by throwing in a piece of the onion, it should sizzle vigorously. reduce the heat to medium -high and, carefully add a third of the sliced onion. Fry for five to seven minutes, stirring occasionally with a slotted spoon, until the onion takes on a nice, golden-brown colour and turns crispy. Use the spoon to transfer the onion to a colander and sprinkle with a little more salt salt. Repeat with two more batches of onion, adding more oil if needed.
Wipe clean the saucepan in which you fried the onion and drop in the cumin and coriander seeds. Place over a medium heat and toast the seeds for a minute or two, until they release those distinctive aromas. Add the rice, olive oil, turmeric, allspice, cinnamon, sugar, half a teaspoon of salt and plenty of black pepper. Stir to coat the rice with oil, then add the cooked lentils and water. Bring to a boil, cover and simmer on very low heat for 15 minutes.
Remove from the heat, lift off the lid and cover the pan with a clean tea towel. Seal tightly with the lid and set aside for 10 minutes. Finally, tip the rice and lentils into a large mixing bowl. Add half the fried onion and stir gently with a fork. Pile up in a shallow serving bowl and top with the rest of the onion.