예제 #1
0
        private void SearchRecursive(FileElement element, string term, SearchOptions options, ref HashSet <long> result, bool autoAdd)
        {
            if (term == null)
            {
                return;
            }

            bool shouldAdd = autoAdd;

            if (!shouldAdd)
            {
                var tokens = term
                             .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                             .Select(t => t.Trim());

                shouldAdd = true;
                foreach (var token in tokens)
                {
                    shouldAdd = shouldAdd && element.RawText.Contains(token, StringComparison.InvariantCultureIgnoreCase);
                }
            }
            if (shouldAdd)
            {
                result.Add(element.ParagraphNumber);
            }

            foreach (var child in element.Children)
            {
                SearchRecursive(child, term, options, ref result, shouldAdd);
            }
        }
예제 #2
0
파일: File.cs 프로젝트: genveir/LijstenMam
        public void MapElements(FileElement element)
        {
            if (ElementsByParagraphId == null)
            {
                ElementsByParagraphId = new Dictionary <long, FileElement>();
            }
            ElementsByParagraphId[element.ParagraphNumber] = element;

            foreach (var child in element.Children)
            {
                MapElements(child);
            }
        }
예제 #3
0
 internal abstract void AddTo(FileElement element);