Esempio n. 1
0
        /// <summary>
        /// Return a query that will return docs like the passed lucene document ID.
        /// </summary>
        /// <param name="docNum"> the documentID of the lucene doc to generate the 'More Like This" query for. </param>
        /// <returns> a query that will return docs like the passed lucene document ID. </returns>
        public Query Like(int docNum)
        {
            if (FieldNames == null)
            {
                // gather list of valid fields from lucene
                ICollection <string> fields = MultiFields.GetIndexedFields(ir);
                FieldNames = fields.ToArray();
            }

            return(CreateQuery(RetrieveTerms(docNum)));
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new <see cref="QueryAutoStopWordAnalyzer"/> with stopwords calculated for all
 /// indexed fields from terms with a document frequency percentage greater than
 /// the given <paramref name="maxPercentDocs"/>
 /// </summary>
 /// <param name="matchVersion"> Version to be used in <see cref="StopFilter"/> </param>
 /// <param name="delegate"> <see cref="Analyzer"/> whose <see cref="TokenStream"/> will be filtered </param>
 /// <param name="indexReader"> <see cref="IndexReader"/> to identify the stopwords from </param>
 /// <param name="maxPercentDocs"> The maximum percentage (between 0.0 and 1.0) of index documents which
 ///                      contain a term, after which the word is considered to be a stop word </param>
 /// <exception cref="IOException"> Can be thrown while reading from the <see cref="IndexReader"/> </exception>
 public QueryAutoStopWordAnalyzer(LuceneVersion matchVersion, Analyzer @delegate, IndexReader indexReader, float maxPercentDocs)
     : this(matchVersion, @delegate, indexReader, MultiFields.GetIndexedFields(indexReader), maxPercentDocs)
 {
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a new QueryAutoStopWordAnalyzer with stopwords calculated for all
 /// indexed fields from terms with a document frequency greater than the given
 /// maxDocFreq
 /// </summary>
 /// <param name="matchVersion"> Version to be used in <seealso cref="StopFilter"/> </param>
 /// <param name="delegate"> Analyzer whose TokenStream will be filtered </param>
 /// <param name="indexReader"> IndexReader to identify the stopwords from </param>
 /// <param name="maxDocFreq"> Document frequency terms should be above in order to be stopwords </param>
 /// <exception cref="IOException"> Can be thrown while reading from the IndexReader </exception>
 public QueryAutoStopWordAnalyzer(Version matchVersion, Analyzer @delegate, IndexReader indexReader, int maxDocFreq)
     : this(matchVersion, @delegate, indexReader, MultiFields.GetIndexedFields(indexReader), maxDocFreq)
 {
 }