/// <summary>
        /// Queries the inverted index
        /// </summary>
        /// <returns>Returns the document ids that meets the query</returns>
        public SortedSet <int> QueryString()
        {
            //Handles one word and free text query.
            List <SortedSet <int> > eachWordsDocIds = new List <SortedSet <int> >();
            SortedSet <int>         result          = new SortedSet <int>();
            var wordsInQuery = EachTermSearched();

            //separate each word in the query
            for (int index = 0; index < wordsInQuery.Length; index++)
            {
                eachWordsDocIds.Add(new SortedSet <int>());
                var term = wordsInQuery[index];
                if (invertedIndex.ContainTerm(term)) //if the term is present in the invertedIndex
                {
                    foreach (var tuple in invertedIndex[term])
                    {
                        eachWordsDocIds[index].Add(tuple.DocumentId);
                        //get the docIds of in the postings list of the term
                    }
                }
                result.UnionWith(eachWordsDocIds[index]); //Union the idList of each term with the final result.
            }
            return(result);
        }