public ImmutableIndex(StringComparison wordComparison)
 {
     this.wordComparer = new StringComparisonComparer(wordComparison);
     this.state        = new State(
         new InternalSortedList <string, IImmutableSet <DocumentInfo> >(wordComparer),
         ImmutableHashSet <DocumentInfo> .Empty);
 }
Exemple #2
0
        public LockingIndex(StringComparison wordComparison, [NotNull] LockingStrategy locking)
        {
            if (locking == null)
            {
                throw new ArgumentNullException("locking");
            }

            this.wordComparer = new StringComparisonComparer(wordComparison);
            this.wordIndex    = new SortedList <string, ISet <DocumentInfo> >(wordComparer);
            this.allDocuments = new HashSet <DocumentInfo>();
            this.locking      = locking;
        }
Exemple #3
0
        /// <summary>
        ///  Creates an instance of <see cref="Indexer"/> that will be indexing documents from
        ///  the specified <paramref name="source"/> with the <paramref name="textParser"/> and
        ///  merging them to the <paramref name="index"/>
        /// </summary>
        /// <param name="index"></param>
        /// <param name="source"></param>
        /// <param name="textParser"></param>
        public Indexer([NotNull] IIndex index, [NotNull] IDocumentSource source, [NotNull] ITextParser textParser)
        {
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (textParser == null)
            {
                throw new ArgumentNullException("textParser");
            }

            this.Index            = index;
            this.Source           = source;
            this.TextParser       = textParser;
            this.textParserReader = textParser.ExtractWords;
            this.wordComparer     = new StringComparisonComparer(index.WordComparison);
        }
 private ImmutableIndex(InternalSortedList <string, IImmutableSet <DocumentInfo> > wordIndex, IImmutableSet <DocumentInfo> allDocuments)
 {
     this.wordComparer = (StringComparisonComparer)wordIndex.KeyComparer;
     this.state        = new State(wordIndex, allDocuments);
 }