public void SolrTermCorrectlyEscapesMultipleSpecialCharacters() { var token = new RiakSearchToken(); var spt = new RiakSearchPhraseToken("2+2-2"); token.Term = spt; string escapedString = token.ToString(); escapedString.Contains(@"\").ShouldBeTrue(); escapedString.Equals(@"2\+2\-2").ShouldBeTrue(); }
public void BoostedPhrasesShouldContainACaretOutsideOfQuotedString() { var token = new RiakSearchToken {Field = "artist", Boost = 10}; var spt = new RiakSearchPhraseToken("The Rolling Stones"); token.Term = spt; string result = token.ToString(); result.Contains("^").ShouldBeTrue(); result.ShouldEqual(@"artist:""The Rolling Stones""^10"); }
public void BoostedTermsShouldContainACaret() { var token = new RiakSearchToken {Boost = 10}; var spt = new RiakSearchPhraseToken("Erlang"); token.Term = spt; string result = token.ToString(); result.Contains("^").ShouldBeTrue(); result.Equals("Erlang^10").ShouldBeTrue(); }
public void RequiredTermsShouldBePrefixedWithAPlusSign() { var token = new RiakSearchToken {Required = true}; var spt = new RiakSearchPhraseToken("riak"); token.Term = spt; string result = token.ToString(); result.Contains("+").ShouldBeTrue(); result.Equals("+riak").ShouldBeTrue(); }
public void ExclusiveTermShouldBeFormattedCorrecly() { var token = new RiakSearchToken {Field = "title"}; var srt = new RiakSearchRangeToken {From = "Aida", To = "Carmen", Inclusive = false}; token.Term = srt; token.Term.ToSearchTerm().ShouldEqual("{Aida TO Carmen}"); token.ToString().ShouldEqual("title:{Aida TO Carmen}"); }
public void InclusiveTermShouldBeFormattedCorrecly() { var token = new RiakSearchToken(); var srt = new RiakSearchRangeToken {From = "20020101", To = "20030101", Inclusive = true}; token.Field = "mod_date"; token.Term = srt; token.Term.ToSearchTerm().ShouldEqual("[20020101 TO 20030101]"); token.ToString().ShouldEqual("mod_date:[20020101 TO 20030101]"); }
public void OrTokensAreFormattedCorrectly() { var first = new RiakSearchToken {Term = new RiakSearchPhraseToken("coffee")}; var second = new RiakSearchToken {Term = new RiakSearchPhraseToken("tea")}; var or = new Or(first, second); var result = or.ToString(); result.Contains("OR").ShouldBeTrue(); result.ShouldEqual("coffee OR tea"); }
public void GroupTokensAreFormattedCorrectly() { var first = new RiakSearchToken {Term = new RiakSearchPhraseToken("coffee")}; var second = new RiakSearchToken {Term = new RiakSearchPhraseToken("tea")}; var or = new Or(first, second); var g = new Group(); g.AddItem(or); string result = g.ToString(); result.Contains("OR").ShouldBeTrue(); result.ShouldEqual("(coffee OR tea)"); }
public void AndTokensAreFormattedCorrectly() { var first = new RiakSearchToken {Term = new RiakSearchPhraseToken("coffee")}; var second = new RiakSearchToken {Term = new RiakSearchPhraseToken("tea")}; var and = new And(first, second); var result = and.ToString(); result.Contains("AND").ShouldBeTrue(); result.ShouldEqual("coffee AND tea"); }
public void SolrTermWithSpacesShouldBeQuoted() { var token = new RiakSearchToken {Field = "artist"}; var spt = new RiakSearchPhraseToken("The Rolling Stones"); token.Term = spt; string result = token.ToString(); result.Equals(@"artist:""The Rolling Stones""").ShouldBeTrue(); }
public void SolrTermIncludesFieldName() { var token = new RiakSearchToken {Field = "eyes"}; var spt = new RiakSearchPhraseToken("blue"); token.Term = spt; string result = token.ToString(); result.Contains("eyes").ShouldBeTrue(); result.Contains("blue").ShouldBeTrue(); result.Equals("eyes:blue").ShouldBeTrue(); }