Algorithmic framework for X-ray nanocrystallographic reconstruction in the presence of the indexing ambiguity