Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
EmptyCollector.cs
Go to the documentation of this file.
1 /*
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements. See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership. The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied. See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20 */
21 
22 using System;
23 using System.Collections.Generic;
24 using System.Linq;
25 using System.Text;
26 using Lucene.Net.Search;
27 
28 namespace Lucene.Net.Index.Memory
29 {
30  public partial class MemoryIndex
31  {
32  /// <summary>
33  /// Fills the given float array with the values
34  /// as the collector scores the search
35  /// </summary>
36  private sealed class FillingCollector : Collector
37  {
38  private readonly float[] _scores;
39  private Scorer _scorer;
40 
41  public FillingCollector(float[] scores)
42  {
43  _scores = scores;
44  }
45 
46  public override void SetScorer(Scorer scorer)
47  {
48  _scorer = scorer;
49  }
50 
51  public override void Collect(int doc)
52  {
53  _scores[0] = _scorer.Score();
54  }
55 
56  public override void SetNextReader(IndexReader reader, int docBase)
57  { }
58 
59  public override bool AcceptsDocsOutOfOrder
60  {
61  get { return true; }
62  }
63  }
64  }
65 }