Exemple #1
0
        private string GetFieldFromExtractTerms(Query query)
        {
            ISet <Term> terms = new HashSet <Term>();

            try
            {
                _searcher.createNormalizedWeight(query, false).extractTerms(terms);
            }
            catch (IOException ioe)
            {
                throw new System.NotSupportedException(ioe);
            }
            catch (System.NotSupportedException)
            {
                // TODO This is for "*" queries and such. Lucene doesn't seem
                // to be able/willing to rewrite such queries.
                // Just ignore the orphans then... OK?
            }
            return(terms.Count == 0 ? null : terms.GetEnumerator().next().field());
        }