コード例 #1
0
        public static bool TryGetId(int docId, Scope scope, IIndex index, IndexState indexState, out Guid result)
        {
            result = Guid.Empty;

            indexState.Get(docId, out var draft, out var published);

            if (scope == Scope.Draft && !draft)
            {
                return(false);
            }

            if (scope == Scope.Published && !published)
            {
                return(false);
            }

            var document = index.Searcher?.Doc(docId);

            if (document != null)
            {
                var idString = document.Get(MetaId);

                if (!Guid.TryParse(idString, out result))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        private bool IsForPublished(Scope scope, int docId)
        {
            indexState.Get(id, scope, docId, out _, out var forPublished);

            return(forPublished);
        }