public override sealed string[] ListAll() { EnsureOpen(); // NOTE: fileMap.keySet().toArray(new String[0]) is broken in non Sun JDKs, // and the code below is resilient to map changes during the array population. //IDictionary<string, RAMFile>.KeyCollection fileNames = FileMap.Keys; ISet <string> fileNames = SetFactory.CreateHashSet(FileMap.Keys);//just want a set of strings IList <string> names = new List <string>(fileNames.Count); foreach (string name in fileNames) { names.Add(name); } return(names.ToArray()); }
public void flatten(Query sourceQuery, Dictionary <Query, Query> flatQueries) { if (sourceQuery is BooleanQuery) { BooleanQuery bq = (BooleanQuery)sourceQuery; foreach (BooleanClause clause in bq.GetClauses()) { if (!clause.IsProhibited) { flatten(clause.Query, flatQueries); } } } else if (sourceQuery is PrefixQuery) { if (!flatQueries.ContainsKey(sourceQuery)) { flatQueries.Add(sourceQuery, sourceQuery); } } else if (sourceQuery is DisjunctionMaxQuery) { DisjunctionMaxQuery dmq = (DisjunctionMaxQuery)sourceQuery; foreach (Query query in dmq) { flatten(query, flatQueries); } } else if (sourceQuery is TermQuery) { if (!flatQueries.ContainsKey(sourceQuery)) { flatQueries.Add(sourceQuery, sourceQuery); } } else if (sourceQuery is PhraseQuery) { if (!flatQueries.ContainsKey(sourceQuery)) { PhraseQuery pq = (PhraseQuery)sourceQuery; if (pq.GetTerms().Length > 1) { flatQueries.Add(pq, pq); } else if (pq.GetTerms().Length == 1) { Query q = new TermQuery(pq.GetTerms()[0]); flatQueries.Add(q, q); } } } else { // Fallback to using extracted terms ISet <Term> terms = SetFactory.CreateHashSet <Term>(); try { sourceQuery.ExtractTerms(terms); } catch (NotSupportedException) { // thrown by default impl return; // ignore error and discard query } foreach (var term in terms) { flatten(new TermQuery(term), flatQueries); } } }
/* * Builds an exclusionlist from a {@link Map}. * @deprecated use {@link #BrazilianAnalyzer(Version, Set, Set)} instead */ public void SetStemExclusionTable(IDictionary <string, string> exclusionlist) { this.excltable = SetFactory.CreateHashSet(exclusionlist.Keys); this.PreviousTokenStream = null; // force a new stemmer to be created }