public MultiSearcherThread(Lucene.Net.Search.Searchable searchable, Weight weight, Filter filter, int nDocs, HitQueue hq, int i, int[] starts, System.String name) : base(name)
 {
     this.searchable = searchable;
     this.weight     = weight;
     this.filter     = filter;
     this.nDocs      = nDocs;
     this.hq         = hq;
     this.i          = i;
     this.starts     = starts;
 }
 public MultiSearcherThread(Searchable searchable, Weight weight, Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int i, int[] starts, System.String name) : base(name)
 {
     this.searchable = searchable;
     this.weight     = weight;
     this.filter     = filter;
     this.nDocs      = nDocs;
     this.hq         = hq;
     this.i          = i;
     this.starts     = starts;
     this.sort       = sort;
 }
Пример #3
0
        /// <summary> Convenience routine to make it easy to return the most interesting words in a document.
        /// More advanced users will call <see cref="RetrieveTerms(System.IO.StreamReader)"/> directly.
        /// </summary>
        /// <param name="r">the source document
        /// </param>
        /// <returns> the most interesting words in the document
        ///
        /// </returns>
        /// <seealso cref="RetrieveTerms(System.IO.StreamReader)">
        /// </seealso>
        /// <seealso cref="SetMaxQueryTerms">
        /// </seealso>
        public System.String[] RetrieveInterestingTerms(System.IO.StreamReader r)
        {
            System.Collections.ArrayList al = new System.Collections.ArrayList(maxQueryTerms);
            PriorityQueue pq = RetrieveTerms(r);

            System.Object cur;
            int           lim = maxQueryTerms;   // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...

            // we just want to return the top words
            while (((cur = pq.Pop()) != null) && lim-- > 0)
            {
                System.Object[] ar = (System.Object[])cur;
                al.Add(ar[0]);                 // the 1st entry is the interesting word
            }
            System.String[] res = new System.String[al.Count];
            // return (System.String[]) SupportClass.ICollectionSupport.ToArray(al, res);
            return((System.String[])al.ToArray(typeof(System.String)));
        }
Пример #4
0
        /// <summary> Create the More like query from a PriorityQueue</summary>
        private Query CreateQuery(PriorityQueue q)
        {
            BooleanQuery query = new BooleanQuery();

            System.Object cur;
            int           qterms    = 0;
            float         bestScore = 0;

            while (((cur = q.Pop()) != null))
            {
                System.Object[] ar = (System.Object[])cur;
                TermQuery       tq = new TermQuery(new Term((System.String)ar[1], (System.String)ar[0]));

                if (boost)
                {
                    if (qterms == 0)
                    {
                        bestScore = (float)((System.Single)ar[2]);
                    }
                    float myScore = (float)((System.Single)ar[2]);

                    tq.SetBoost(myScore / bestScore);
                }

                try
                {
                    query.Add(tq, BooleanClause.Occur.SHOULD);
                }
                catch (BooleanQuery.TooManyClauses)
                {
                    break;
                }

                qterms++;
                if (maxQueryTerms > 0 && qterms >= maxQueryTerms)
                {
                    break;
                }
            }

            return(query);
        }
Пример #5
0
			internal JustCompileTopDocsCollector(PriorityQueue pq):base(pq)
			{
			}
Пример #6
0
        /// <summary> Create the More like query from a PriorityQueue</summary>
        private Query CreateQuery(PriorityQueue q)
        {
            BooleanQuery query = new BooleanQuery();
            System.Object cur;
            int qterms = 0;
            float bestScore = 0;
			
            while (((cur = q.Pop()) != null))
            {
                System.Object[] ar = (System.Object[]) cur;
                TermQuery tq = new TermQuery(new Term((System.String) ar[1], (System.String) ar[0]));
				
                if (boost)
                {
                    if (qterms == 0)
                    {
                        bestScore = (float) ((System.Single) ar[2]);
                    }
                    float myScore = (float) ((System.Single) ar[2]);
					
                    tq.SetBoost(myScore / bestScore);
                }
				
                try
                {
                    query.Add(tq, BooleanClause.Occur.SHOULD);
                }
                catch (BooleanQuery.TooManyClauses ignore)
                {
                    break;
                }
				
                qterms++;
                if (maxQueryTerms > 0 && qterms >= maxQueryTerms)
                {
                    break;
                }
            }
			
            return query;
        }
Пример #7
0
 // Declaring the constructor private prevents extending this class by anyone
 // else. Note that the class cannot be final since it's extended by the
 // internal versions. If someone will define a constructor with any other
 // visibility, then anyone will be able to extend the class, which is not what
 // we want.
 private TopFieldCollector(PriorityQueue pq, int numHits, bool fillFields) : base(pq)
 {
     this.numHits    = numHits;
     this.fillFields = fillFields;
 }
Пример #8
0
 internal TopDocCollector(int numHits, PriorityQueue hq)
 {
     this.numHits = numHits;
     this.hq      = hq;
 }
Пример #9
0
 // Declaring the constructor private prevents extending this class by anyone
 // else. Note that the class cannot be final since it's extended by the
 // internal versions. If someone will define a constructor with any other
 // visibility, then anyone will be able to extend the class, which is not what
 // we want.
 private TopFieldCollector(PriorityQueue pq, int numHits, bool fillFields)
     : base(pq)
 {
     this.numHits = numHits;
     this.fillFields = fillFields;
 }
 public MultiSearcherThread(Searchable searchable, Weight weight, Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int i, int[] starts, System.String name)
     : base(name)
 {
     this.searchable = searchable;
     this.weight = weight;
     this.filter = filter;
     this.nDocs = nDocs;
     this.hq = hq;
     this.i = i;
     this.starts = starts;
     this.sort = sort;
 }
Пример #11
0
 protected internal TopDocsCollector(PriorityQueue pq)
 {
     this.pq = pq;
 }
Пример #12
0
 /// <summary>Constructor to collect the top-scoring documents by using the given PQ.</summary>
 /// <param name="hq">the PQ to use by this instance.
 /// </param>
 protected internal TopDocCollector(PriorityQueue hq)
 {
     this.hq = hq;
 }
Пример #13
0
		public MultiSearcherThread(Lucene.Net.Search.Searchable searchable, Weight weight, Filter filter, int nDocs, HitQueue hq, int i, int[] starts, System.String name):base(name)
		{
			this.searchable = searchable;
			this.weight = weight;
			this.filter = filter;
			this.nDocs = nDocs;
			this.hq = hq;
			this.i = i;
			this.starts = starts;
		}
Пример #14
0
 protected internal TopDocsCollector(PriorityQueue pq)
 {
     this.pq = pq;
 }
Пример #15
0
		internal TopDocCollector(int numHits, PriorityQueue hq)
		{
			this.hq = hq;
		}
Пример #16
0
		/// <summary>Constructor to collect the top-scoring documents by using the given PQ.</summary>
		/// <param name="hq">the PQ to use by this instance.
		/// </param>
		protected internal TopDocCollector(PriorityQueue hq)
		{
			this.hq = hq;
		}
Пример #17
0
 internal JustCompileTopDocsCollector(PriorityQueue pq) : base(pq)
 {
 }