Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7
This commit is contained in:
@@ -50,18 +50,6 @@ namespace Umbraco.Web
|
||||
/// <returns></returns>
|
||||
IEnumerable<IPublishedContent> TypedSearch(string term, bool useWildCards = true, string searchProvider = null);
|
||||
|
||||
/// <summary>
|
||||
/// Searches content
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="take"></param>
|
||||
/// <param name="totalRecords"></param>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="useWildCards"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, string term, bool useWildCards = true, string searchProvider = null);
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
@@ -69,13 +57,5 @@ namespace Umbraco.Web
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IPublishedContent> TypedSearch(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null);
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
/// <param name="criteria"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalrecords, Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null);
|
||||
}
|
||||
}
|
||||
@@ -383,38 +383,6 @@ namespace Umbraco.Web
|
||||
: _dynamicContentQuery.Search(criteria, searchProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches content
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="take"></param>
|
||||
/// <param name="totalRecords"></param>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="useWildCards"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, string term, bool useWildCards = true, string searchProvider = null)
|
||||
{
|
||||
if (_typedContentQuery != null) return _typedContentQuery.TypedSearch(skip, take, out totalRecords, term, useWildCards, searchProvider);
|
||||
|
||||
var searcher = Examine.ExamineManager.Instance.DefaultSearchProvider;
|
||||
if (string.IsNullOrEmpty(searchProvider) == false)
|
||||
searcher = Examine.ExamineManager.Instance.SearchProviderCollection[searchProvider];
|
||||
|
||||
var results = searcher.Search(term, useWildCards);
|
||||
|
||||
totalRecords = results.TotalItemCount;
|
||||
|
||||
var records = results.Skip(skip);
|
||||
|
||||
if (take > 0)
|
||||
{
|
||||
records = records.Take(take);
|
||||
}
|
||||
|
||||
return records.ConvertSearchResultToPublishedContent(_contentCache);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches content
|
||||
/// </summary>
|
||||
@@ -423,42 +391,16 @@ namespace Umbraco.Web
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(string term, bool useWildCards = true, string searchProvider = null)
|
||||
{
|
||||
var total = 0;
|
||||
|
||||
return TypedSearch(0, 0, out total, term, useWildCards, searchProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="take"></param>
|
||||
/// <param name="totalRecords"></param>
|
||||
/// <param name="criteria"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
|
||||
{
|
||||
if (_typedContentQuery != null) return _typedContentQuery.TypedSearch(skip, take, out totalRecords, criteria, searchProvider);
|
||||
if (_typedContentQuery != null) return _typedContentQuery.TypedSearch(term, useWildCards, searchProvider);
|
||||
|
||||
var s = Examine.ExamineManager.Instance.DefaultSearchProvider;
|
||||
if (searchProvider != null)
|
||||
s = searchProvider;
|
||||
var searcher = Examine.ExamineManager.Instance.DefaultSearchProvider;
|
||||
if (string.IsNullOrEmpty(searchProvider) == false)
|
||||
searcher = Examine.ExamineManager.Instance.SearchProviderCollection[searchProvider];
|
||||
|
||||
var results = s.Search(criteria);
|
||||
|
||||
totalRecords = results.TotalItemCount;
|
||||
|
||||
var records = results.Skip(skip);
|
||||
|
||||
if (take > 0)
|
||||
{
|
||||
records = records.Take(take);
|
||||
}
|
||||
|
||||
return records.ConvertSearchResultToPublishedContent(_contentCache);
|
||||
}
|
||||
var results = searcher.Search(term, useWildCards);
|
||||
return results.ConvertSearchResultToPublishedContent(_contentCache);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
@@ -468,9 +410,14 @@ namespace Umbraco.Web
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
|
||||
{
|
||||
var total = 0;
|
||||
|
||||
return TypedSearch(0, 0, out total, criteria, searchProvider);
|
||||
if (_typedContentQuery != null) return _typedContentQuery.TypedSearch(criteria, searchProvider);
|
||||
|
||||
var s = Examine.ExamineManager.Instance.DefaultSearchProvider;
|
||||
if (searchProvider != null)
|
||||
s = searchProvider;
|
||||
|
||||
var results = s.Search(criteria);
|
||||
return results.ConvertSearchResultToPublishedContent(_contentCache);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1251,53 +1251,24 @@ namespace Umbraco.Web
|
||||
public IEnumerable<IPublishedContent> TypedSearch(string term, bool useWildCards = true, string searchProvider = null)
|
||||
{
|
||||
return ContentQuery.TypedSearch(term, useWildCards, searchProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches content
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="take"></param>
|
||||
/// <param name="totalRecords"></param>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="useWildCards"></param>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
/// <param name="criteria"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, string term, bool useWildCards = true, string searchProvider = null)
|
||||
{
|
||||
return ContentQuery.TypedSearch(skip, take, out totalRecords, term, useWildCards, searchProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <param name="take"></param>
|
||||
/// <param name="totalRecords"></param>
|
||||
/// <param name="criteria"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(int skip, int take, out int totalRecords, Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
|
||||
public IEnumerable<IPublishedContent> TypedSearch(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
|
||||
{
|
||||
return ContentQuery.TypedSearch(skip, take, out totalRecords, criteria, searchProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searhes content
|
||||
/// </summary>
|
||||
/// <param name="criteria"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<IPublishedContent> TypedSearch(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
|
||||
{
|
||||
return ContentQuery.TypedSearch(criteria, searchProvider);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Xml
|
||||
|
||||
public dynamic ToDynamicXml(string xml)
|
||||
return ContentQuery.TypedSearch(criteria, searchProvider);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Xml
|
||||
|
||||
public dynamic ToDynamicXml(string xml)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(xml)) return null;
|
||||
var xElement = XElement.Parse(xml);
|
||||
@@ -1468,8 +1439,8 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
public IHtmlString Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent)
|
||||
{
|
||||
return _stringUtilities.Truncate(html, length, addElipsis, treatTagsAsContent);
|
||||
}
|
||||
return _stringUtilities.Truncate(html, length, addElipsis, treatTagsAsContent);
|
||||
}
|
||||
#region Truncate by Words
|
||||
|
||||
/// <summary>
|
||||
@@ -1480,7 +1451,7 @@ namespace Umbraco.Web
|
||||
int length = _stringUtilities.WordsToLength(html, words);
|
||||
|
||||
return Truncate(html, length, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them
|
||||
@@ -1510,12 +1481,12 @@ namespace Umbraco.Web
|
||||
int length = _stringUtilities.WordsToLength(html.ToHtmlString(), words);
|
||||
|
||||
return Truncate(html, length, addElipsis, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
#region If
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user