Lucene.Net.Search.IndexSearcher.SetDefaultFieldSortScoring C# (CSharp) Method

SetDefaultFieldSortScoring() public method

By default, no scores are computed when sorting by field (using Searcher.Search(Query,Filter,int,Sort)). You can change that, per IndexSearcher instance, by calling this method. Note that this will incur a CPU cost.
public SetDefaultFieldSortScoring ( bool doTrackScores, bool doMaxScore ) : void
doTrackScores bool If true, then scores are returned for every matching document /// in . /// ///
doMaxScore bool If true, then the max score for all matching docs is computed. ///
return void
		public virtual void  SetDefaultFieldSortScoring(bool doTrackScores, bool doMaxScore)
		{
			fieldSortDoTrackScores = doTrackScores;
			fieldSortDoMaxScore = doMaxScore;
		}

Usage Example

示例#1
0
 public void DisplayResults(Query query, Sort sort)
 {
     using(var indexSearcher = new IndexSearcher(directory, true))
     {
         indexSearcher.SetDefaultFieldSortScoring(true, false);
         var results = indexSearcher.Search(query, null, 20, sort);
         Console.WriteLine("\nResults for: {0} sorted by {1}", query, sort);
         Console.WriteLine();
     }
 }
All Usage Examples Of Lucene.Net.Search.IndexSearcher::SetDefaultFieldSortScoring