<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Disco.Models.Services.Searching
{
    public class DeviceSearchResultItem : ISearchResultItem
    {
        private const string type = "Device";

        public string Id { get; set; }
        public string Type { get { return type; } }
        public string Description { get { return string.Format("{0} ({1})", this.Id, this.ComputerName); } }
        public string ScoreValue { get { return string.Format("{0} {1} {2} {3} {4}", this.Id, this.AssignedUserId.Substring(0, this.AssignedUserId.IndexOf('\\')), this.AssignedUserId, this.AssignedUserDisplayName, this.AssetNumber); } }

        public string AssetNumber { get; set; }
        public string AssignedUserDescription
        {
            get
            {
                if (AssignedUserId != null)
                {
                    if (AssignedUserDisplayName != null)
                        return string.Format("{0} ({1})", AssignedUserDisplayName, AssignedUserId);
                    else
                        return AssignedUserId;
                }
                return string.Empty;
            }
        }
        public string AssignedUserDisplayName { get; set; }
        public string AssignedUserId { get; set; }
        public string ComputerName { get; set; }
        public string DeviceModelDescription { get; set; }
        public string DeviceProfileDescription { get; set; }
        public int JobCount { get; set; }
        public DateTime? DecommissionedDate { get; set; }
    }
}<commit_msg>Bug Fix: Search fails with unassigned devices<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Disco.Models.Services.Searching
{
    public class DeviceSearchResultItem : ISearchResultItem
    {
        private const string type = "Device";

        public string Id { get; set; }
        public string Type { get { return type; } }
        public string Description { get { return string.Format("{0} ({1})", this.Id, this.ComputerName); } }
        public string ScoreValue { get { return string.Format("{0} {1} {2} {3} {4}", this.Id, this.AssignedUserId != null ? this.AssignedUserId.Substring(0, this.AssignedUserId.IndexOf('\\')) : null, this.AssignedUserId, this.AssignedUserDisplayName, this.AssetNumber); } }

        public string AssetNumber { get; set; }
        public string AssignedUserDescription
        {
            get
            {
                if (AssignedUserId != null)
                {
                    if (AssignedUserDisplayName != null)
                        return string.Format("{0} ({1})", AssignedUserDisplayName, AssignedUserId);
                    else
                        return AssignedUserId;
                }
                return string.Empty;
            }
        }
        public string AssignedUserDisplayName { get; set; }
        public string AssignedUserId { get; set; }
        public string ComputerName { get; set; }
        public string DeviceModelDescription { get; set; }
        public string DeviceProfileDescription { get; set; }
        public int JobCount { get; set; }
        public DateTime? DecommissionedDate { get; set; }
    }
}
{'fraction_non_alphanumeric': 0.09906934854398079, 'fraction_numerical': 0.006004202942059442, 'mean_word_length': 2.18546845124283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6957659', 'n_tokens_mistral': 875, 'n_tokens_neox': 867, 'n_words': 243}