本文整理汇总了C#中Query.ConstructQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Query.ConstructQuery方法的具体用法?C# Query.ConstructQuery怎么用?C# Query.ConstructQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.ConstructQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructingQueryWithSpecifiedQueryAndAdditionalQueryPhraseShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndAdditionalQueryPhraseShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.AdditionalQueryPhrase = "phrase";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&as_epq=phrase", q.ConstructQuery());
}
示例2: ConstructingQueryWithSpecifiedQueryAndAddedSearchTermShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndAddedSearchTermShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.AddedSearchTerm = "added";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&as_q=added", q.ConstructQuery());
}
示例3: MetaDataFieldsShouldBeCorrectlyEncoded
public void MetaDataFieldsShouldBeCorrectlyEncoded()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "Meta";
q.RequiredFields = new List<MetaDataField>();
StringAssert.Contains("?q=Meta", q.ConstructQuery());
StringAssert.DoesNotContain("&requiredfields=", q.ConstructQuery());
q.RequiredFields.Add(new MetaDataField { Key = "department", Value = "Human Resources", MetaDataSearchSpecification = MetaDataSearchSpecification.And });
q.RequiredFields.Add(new MetaDataField { Key = "metakey2", Value = "metavalue2" });
StringAssert.Contains("&requiredfields=department:Human%2520Resources.metakey2:metavalue2", q.ConstructQuery());
}
示例4: PartialMetaDataSearchWithOrShouldYieldCorrectUrl
public void PartialMetaDataSearchWithOrShouldYieldCorrectUrl()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "Meta";
q.PartialFields = new List<MetaDataField>();
StringAssert.Contains("?q=Meta", q.ConstructQuery());
StringAssert.DoesNotContain("&partialfields=", q.ConstructQuery());
q.PartialFields.Add(new MetaDataField { Key = "metakey", Value = "metavalue", MetaDataSearchSpecification = MetaDataSearchSpecification.Or });
q.PartialFields.Add(new MetaDataField { Key = "metakey2", Value = "metavalue2" });
StringAssert.Contains("&partialfields=metakey:metavalue|metakey2:metavalue2", q.ConstructQuery());
}
示例5: ConstructingQueryWithoutSpecifyingAnyParametersShouldYieldCorrectQuery
public void ConstructingQueryWithoutSpecifyingAnyParametersShouldYieldCorrectQuery()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
StringAssert.AreEqualIgnoringCase("http://google04.domain.se/search/?q=&ie=utf8&oe=utf8&output=xml_no_dtd", q.ConstructQuery());
}
示例6: ConstructingQueryWithSpecifiedQueryAndAccessShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndAccessShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.Access = SearchAccess.Public;
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&access=p", q.ConstructQuery());
q.Access = SearchAccess.Secure;
StringAssert.Contains("&access=s", q.ConstructQuery());
q.Access = SearchAccess.All;
StringAssert.Contains("&access=a", q.ConstructQuery());
q.Access = SearchAccess.Ignore;
StringAssert.DoesNotContain("&access=", q.ConstructQuery());
}
示例7: ConstructingQueryWithSpecifiedQueryAndSiteSearchModificationShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndSiteSearchModificationShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.SiteSearchModification = SiteSearchModification.Include;
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&ad_dt=i", q.ConstructQuery());
q.SiteSearchModification = SiteSearchModification.Exclude;
StringAssert.Contains("&ad_dt=e", q.ConstructQuery());
q.SiteSearchModification = SiteSearchModification.Ignore;
StringAssert.DoesNotContain("&ad_dt=", q.ConstructQuery());
}
示例8: ConstructingQueryWithSpecifiedQueryAndSearchLocationShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndSearchLocationShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.SearchLocation = SearchLocation.Anywhere;
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&as_occt=any", q.ConstructQuery());
q.SearchLocation = SearchLocation.Title;
StringAssert.Contains("&as_occt=title", q.ConstructQuery());
q.SearchLocation = SearchLocation.Url;
StringAssert.Contains("&as_occt=url", q.ConstructQuery());
q.SearchLocation = SearchLocation.Ignore;
StringAssert.DoesNotContain("&as_occt=", q.ConstructQuery());
}
示例9: ConstructingQueryWithSpecifiedQueryAndRestrictToLanguageShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndRestrictToLanguageShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.RestrictToLanguage = "lang";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&lr=lang", q.ConstructQuery());
}
示例10: ConstructingQueryWithSpecifiedQueryAndRelevanceScoringShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndRelevanceScoringShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.RelevanceScoring = RelevanceScoring.Advanced;
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&entsp=a", q.ConstructQuery());
q.RelevanceScoring = RelevanceScoring.Standard;
StringAssert.Contains("&entsp=0", q.ConstructQuery());
q.RelevanceScoring = RelevanceScoring.Ignore;
StringAssert.DoesNotContain("&entsp=", q.ConstructQuery());
}
示例11: ConstructingQueryWithSpecifiedQueryAndAsSiteToSearchShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndAsSiteToSearchShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.AsSiteToSearch = "site";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&as_sitesearch=site", q.ConstructQuery());
}
示例12: ConstructingQueryWithSpecifiedQueryAndGetMetaFieldsShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndGetMetaFieldsShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.GetMetaFields = "meta";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&getfields=meta", q.ConstructQuery());
}
示例13: ConstructingQueryWithSpecifiedQueryAndFilterShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndFilterShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.Filter = QueryFilter.DirectoryOnly;
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&filter=s", q.ConstructQuery());
q.Filter = QueryFilter.SnippetAndDirectory;
StringAssert.Contains("&filter=1", q.ConstructQuery());
q.Filter = QueryFilter.None;
StringAssert.Contains("&filter=0", q.ConstructQuery());
q.Filter = QueryFilter.SnippetOnly;
StringAssert.Contains("&filter=p", q.ConstructQuery());
q.Filter = QueryFilter.Ignore;
StringAssert.DoesNotContain("&filter=", q.ConstructQuery());
}
示例14: ConstructingQueryWithSpecifiedQueryAndCollectionsShouldYieldCorrectParameter
public void ConstructingQueryWithSpecifiedQueryAndCollectionsShouldYieldCorrectParameter()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "apa";
q.Collections = "samplecollection";
StringAssert.Contains("?q=apa", q.ConstructQuery());
StringAssert.Contains("&site=samplecollection", q.ConstructQuery());
}
示例15: RequiredMetaDataSearchWithOrAndNotShouldYieldCorrectUrl
public void RequiredMetaDataSearchWithOrAndNotShouldYieldCorrectUrl()
{
var q = new Query();
q.GsaHostAddress = GsaHost;
q.SearchTerm = "Meta";
q.RequiredFields = new List<MetaDataField>();
StringAssert.Contains("?q=Meta", q.ConstructQuery());
StringAssert.DoesNotContain("&requiredfields=", q.ConstructQuery());
q.RequiredFields.Add(new MetaDataField { Key = "metakey", Value = "metavalue", MetaDataSearchSpecification = MetaDataSearchSpecification.Or });
q.RequiredFields.Add(new MetaDataField { Key = "metakey2", Value = "metavalue2", Negate = true});
StringAssert.Contains("&requiredfields=metakey:metavalue|-metakey2:metavalue2", q.ConstructQuery());
}