public void Initialize(FullTextIndex index, Transaction tx, IndexingConventions.ScorerCalc score) { Index = index; Transaction = tx; Score = score; Init(); }
public DefaultScorer(IndexingConventions conventions) { _conventions = conventions; }
public IEnumerable<QueryMatch> Query(Query query, IndexingConventions.ScorerCalc score = null, Sorter sortby = null) { query.Initialize(_index, _tx, score ?? new DefaultScorer(_index.Conventions).Score); return query.Execute(); }
public QueryResults QueryTop(Query query, int take, IndexingConventions.ScorerCalc score = null, Sorter sortBy = null) { if (take < 0) throw new ArgumentException("Take must be non negative"); var qr = new QueryResults(); var heap = new Heap<QueryMatch>(take, GenerateComparisonFunction(sortBy)); foreach (var match in Query(query, score)) { heap.Enqueue(match); qr.TotalResults++; } qr.Results = new QueryMatch[heap.Count]; int pos = 0; while (heap.Count > 0) { qr.Results[pos++] = heap.Dequeue(); } return qr; }