Ejemplo n.º 1
0
        public IEnumerable <DefinitionSearchSpanModel> GetSearchDefinitions()
        {
            var fileTags = GetFileTags().Distinct().ToArray();

            if (!DataInclusion.HasOption(DataInclusionOptions.SearchDefinitions))
            {
                yield break;
            }

            foreach (var definition in Definitions)
            {
                if (definition.Definition.ExcludeFromSearch)
                {
                    continue;
                }

                yield return(new DefinitionSearchSpanModel()
                {
                    FileMergeId = MergeId,
                    Span = definition,
                    //LineSpanText = definition.LineSpanText,
                    FilePath = Path,
                    Language = Language,
                    Tags = fileTags,
                });
            }
        }
Ejemplo n.º 2
0
 public FullTextAttribute(DataInclusionOptions option)
 {
     IndexOptions = IndexOptions.Offsets;
     TermVector   = TermVectorOption.WithPositionsOffsets;
     Analyzer     = CustomAnalyzers.EncodedFullTextAnalyzerName;
     if (!DataInclusion.HasOption(option))
     {
         Ignore = true;
     }
 }
Ejemplo n.º 3
0
        public DataObjectAttribute(DataInclusionOptions option = DataInclusionOptions.None)
        {
            // Store but don't index object fields at all
            Enabled = false;

            if (!DataInclusion.HasOption(option))
            {
                // Don't store the object at all
                Ignore = true;
            }
        }
Ejemplo n.º 4
0
        public IEnumerable <ReferenceSearchResultModel> GetSearchReferences()
        {
            if (!DataInclusion.HasOption(DataInclusionOptions.SearchReferences))
            {
                yield break;
            }

            var referenceLookup = SearchReferencesSource
                                  .Where(r => !(r.Reference.ExcludeFromSearch))
                                  .ToLookup(r => r.Reference, ReferenceListModel.ReferenceSymbolModelComparer);

            foreach (var referenceGroup in referenceLookup.OrderBy(r => r.Key.Id).ThenBy(r => r.Key.ProjectId))
            {
                var searchResultModel = new ReferenceSearchResultModel()
                {
                    FileMergeId = MergeId,
                    FilePath    = Path,
                    Language    = Language,
                    ProjectId   = ProjectId,
                    Reference   = referenceGroup.Key,
                };

                if (referenceGroup.Any(r => r.RelatedDefinition != null))
                {
                    searchResultModel.RelatedDefinitions = new List <string>(
                        referenceGroup.Select(r => r.RelatedDefinition).Where(rd => rd != null).Distinct());
                }

                if (referenceGroup.Count() < 10)
                {
                    searchResultModel.SymbolLineSpans = new List <SymbolLineSpanModel>(
                        referenceGroup.Select(reference => reference.ToLineSpan()));
                }
                else
                {
                    searchResultModel.SymbolLineSpanList = new SymbolLineSpanListModel(referenceGroup.ToObjectModel());
                }

                yield return(searchResultModel);
            }
        }