public void Search(string _searchQuery) { searchQuery = new Page(_searchQuery); //SearchQuery made manageable SearchQueryWeightAndLength(); NormalizeSearchQuery(); //Getting all the documents that have the terms that the Searchquery has documentIDs = GetInvolvedDocuments(); //Weight And length of the relevant documents CalculateWeightAndDocLengthForTerms(); NormalizeWeight(); //Score of the documents CosineSimilarity(); }
public void InsertPosting(Page page) { bool foundIt; if (page.Terms.Count > 0) { foreach (TermVector t in page.Terms) { foundIt = false; foreach (PostingList pl in postings) { if (t.TermString == pl.Term) { foundIt = true; pl.AddToDocAppearances(page.DocId); break; } } if (!foundIt) { postings.Add(new PostingList(t.TermString, page.DocId)); } } } postings = postings.OrderBy(p=>p.Term).ToList(); }