public void SearchEngineService_MoreLikeThisSearch_WithMinDocumentSet_ReturnsEmptySet() { _service.Dispose(); _service = new SearchEngineService(new RAMDirectory(), new SnowballAnalyzer("English", stopWords), new FullTextSearchEngineSettings() { Parameters = new TuningParameters() { MinimumDocumentFrequency = 20 } }); for (int i = 1; i <= 10; i++) { _service.AddPost(new SearchEngineEntry() { EntryId = i, Body = "This is a sample post", Title = "This is the title of the post", Tags = ".net, mvc, post", BlogName = "MyTestBlog", IsPublished = true, PublishDate = DateTime.Now, EntryName = "this-is-the-title" } ); } var result = _service.RelatedContents(1, 100, 0) as List <SearchEngineResult>; Assert.AreEqual(0, result.Count()); }
protected override void OnLoad(EventArgs e) { int blogId = Blog.Id >= 1 ? Blog.Id : 0; var urlRelatedLinks = FindControl("Links") as Repeater; Entry entry = Cacher.GetEntryFromRequest(true, SubtextContext); urlRelatedLinks.DataSource = SearchEngineService.RelatedContents(entry.Id, RowCount, blogId);; urlRelatedLinks.DataBind(); if (urlRelatedLinks.Items.Count == 0) { this.Visible = false; } base.OnLoad(e); }
public void SearchEngineService_PerformsMoreLikeThisSearch() { for (int i = 1; i <= 10; i++) { _service.AddPost(new SearchEngineEntry() { EntryId = i, Body = "This is a sample post", Title = "This is the title of the post", Tags = ".net, mvc, post", BlogName = "MyTestBlog", IsPublished = true, PublishDate = DateTime.Now, EntryName = "this-is-the-title" } ); } var result = _service.RelatedContents(1, 100, 0) as List <SearchEngineResult>; Assert.IsTrue(result.Count > 0); }
public void SearchEngineService_MoreLikeThisSearch_WithMinDocumentSet_ReturnsEmptySet() { _service.Dispose(); _service = new SearchEngineService(new RAMDirectory(), new SnowballAnalyzer("English", stopWords), new FullTextSearchEngineSettings() { Parameters = new TuningParameters() { MinimumDocumentFrequency = 20 } }); for (int i = 1; i <= 10; i++) { _service.AddPost(new SearchEngineEntry() { EntryId = i, Body = "This is a sample post", Title = "This is the title of the post", Tags = ".net, mvc, post", BlogName = "MyTestBlog", IsPublished = true, PublishDate = DateTime.UtcNow, EntryName = "this-is-the-title" } ); } var result = _service.RelatedContents(1, 100, 0) as List<SearchEngineResult>; Assert.AreEqual(0, result.Count()); }