private void InitializeReport(string path)
        {
            m_ReportPath = path;
            m_Report     = SearchReport.LoadFromFile(path);
            m_ReportName = Path.GetFileNameWithoutExtension(path);
            var searchExpressionProvider = SearchService.GetProvider("expression");

            m_Items      = m_Report.CreateSearchItems(searchExpressionProvider).ToList();
            titleContent = new GUIContent($"{m_ReportName} ({m_Items.Count})", m_ReportPath);

            m_FocusSearchField = true;

            // ITableView
            m_TableConfig = new SearchTable(m_ReportName, m_Report.columns);
            for (int i = 0; i < m_TableConfig.columns.Length; ++i)
            {
                InitializeColumn(m_TableConfig.columns[i]);
            }

            m_QueryEngine = new QueryEngine <int>(k_QueryEngineOptions);
            foreach (var column in m_Report.columns)
            {
                var filterName = column.content.text.Replace(" ", "");
                m_QueryEngine.AddFilter(filterName, i => AddFilter(i, column.selector));
                if (filterName != filterName.ToLowerInvariant())
                {
                    m_QueryEngine.AddFilter(filterName.ToLowerInvariant(), i => AddFilter(i, column.selector));
                }

                SearchValue.SetupEngine(m_QueryEngine);
            }
            m_QueryEngine.SetSearchDataCallback(i => m_Items[i].GetFields().Select(f => (f.value ?? "").ToString()), StringComparison.OrdinalIgnoreCase);

            UpdatePropertyTable();
        }
예제 #2
0
        protected QueryBuilder()
        {
            errors = new List <QueryError>();
            blocks = new List <QueryBlock>();
            var opts = new QueryValidationOptions()
            {
                validateSyntaxOnly = true
            };

            m_QueryEngine = new QueryEngine <QueryBlock>(opts);
            m_QueryEngine.AddQuoteDelimiter(new QueryTextDelimiter("<$", "$>"));
            m_QueryEngine.AddQuoteDelimiter(new QueryTextDelimiter("[", "]"));
            m_QueryEngine.AddFilter(new Regex("(#[\\w.]+)"));
            drawBackground = true;
        }