Giter Club home page Giter Club logo

skybrud.umbraco.search's People

Contributors

abjerner avatar nikcio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

skybrud.umbraco.search's Issues

DisableHideFromSearch not working

Example

public VkNewsListOptions()
        {
            ContentTypes = new ContentTypeList { Constants.VkConstants.DocumentTypes.NewsPage };
            DisableHideFromSearch = false;
            RootIds = new int[] { Constants.VkConstants.Pages.NewsList };
            TextFields = new FieldList
            {
                new Field("nodeName_lci", 15),
                new Field("title_lci", 10),
                new Field("teaser_lci", 10)
            };
        }

Outputs:
hideFromSearch:0 (subjectArea_search:6e2715390e0a488791bfaf503d420c8e OR mntpLocations_search:33f2abd6a6b348978fb004362bef8edf OR mntpLocations_search:all OR mntpSubjects_search:all)

public VkNewsListOptions()
        {
            ContentTypes = new ContentTypeList { Constants.VkConstants.DocumentTypes.NewsPage };
            DisableHideFromSearch = true;
            RootIds = new int[] { Constants.VkConstants.Pages.NewsList };
            TextFields = new FieldList
            {
                new Field("nodeName_lci", 15),
                new Field("title_lci", 10),
                new Field("teaser_lci", 10)
            };
        }

Outputs:
hideFromSearch:0 (subjectArea_search:6e2715390e0a488791bfaf503d420c8e OR mntpLocations_search:33f2abd6a6b348978fb004362bef8edf OR mntpLocations_search:all OR mntpSubjects_search:all)

Debugger not working in v8

Example

Works:

VkNewsListOptions options = new VkNewsListOptions(Current.Logger)
            {
                Limit = limit,
                Offset = offset,
                Text = text,
                Location = locationUdi,
                Subject = subjectUdi
            };

Fails:

VkNewsListOptions options = new VkNewsListOptions(Current.Logger)
            {
                Limit = limit,
                Offset = offset,
                Text = text,
                Location = locationUdi,
                Subject = subjectUdi,
                IsDebug = true
            };

FormatException on GetSortValyeByDateTime

Ran into an issue where for some reason it seems the datetime string saved is not a valid datetime. It throws a format exception but it has no info on what it is trying to parse. Would it be possible to add a try catch block here with some helpful logging?

The error gotten is this:

{
    "Message": "An error has occurred.",
    "ExceptionMessage": "String was not recognized as a valid DateTime.",
    "ExceptionType": "System.FormatException",
    "StackTrace": "at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
       at Skybrud.Umbraco.Search.SearchUtils.Sorting.GetSortValueByDateTime(ISearchResult result, String propertyAlias)"
}

It's this method: https://github.com/skybrud/Skybrud.Umbraco.Search/blob/v3/latest/src/Skybrud.Umbraco.Search/SearchUtils.Sorting.cs#L21-L30

Was thinking something along these lines could be super helpful in debugging it!

public static DateTime GetSortValueByDateTime(ISearchResult result, string propertyAlias) {

	string dateString = result.GetValues(propertyAlias)?.FirstOrDefault();
	
	if (!string.IsNullOrWhiteSpace(dateString)) {
		try {
			return DateTime.ParseExact(dateString, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
		} catch(Exception e){
			_logger.Error<SearchUtils>(ex, $"Error trying to convert to datetime for searchresult with id: {result.Id} and propertyAlias: {propertyAlias}")
		}
	} 

	string createdDate = result.GetValues("createDate")?.FirstOrDefault();
	return createdDate == null ? DateTime.MinValue : new DateTime(long.Parse(createdDate));

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.