From e85c9c542e8beca4e6c2a808659c28ef8703b1ee Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Tue, 17 Nov 2015 17:15:13 +0100 Subject: [PATCH] row: expose TermFrequencyRow term and freq fields Rows content is an implementation detail of bleve index and may change in the future. That said, they also contains information valuable to assess the quality of the index or understand its performances. So, as long as we agree that type asserting rows should only be done if you know what you are doing and are ready to deal with future changes, I see no reason to hide the row fields from external packages. Fix #268 --- index/upside_down/row.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index/upside_down/row.go b/index/upside_down/row.go index 442459ef..84bcd35f 100644 --- a/index/upside_down/row.go +++ b/index/upside_down/row.go @@ -355,6 +355,14 @@ type TermFrequencyRow struct { vectors []*TermVector } +func (tfr *TermFrequencyRow) Term() []byte { + return tfr.term +} + +func (tfr *TermFrequencyRow) Freq() uint64 { + return tfr.freq +} + func (tfr *TermFrequencyRow) ScanPrefixForField() []byte { buf := make([]byte, 3) buf[0] = 't'