0
0
Fork 0

adding logging for unexplained observed behavior MB-17298

it would appear that a document lookup for an id fails
but that is a document id that was returned as a search hit
since we're using a stable snapshot, this should not happen
This commit is contained in:
Marty Schoch 2016-01-25 10:44:37 -05:00
parent d97e3caf4f
commit 10e2207179
1 changed files with 5 additions and 1 deletions

View File

@ -446,7 +446,7 @@ func (i *indexImpl) Search(req *SearchRequest) (sr *SearchResult, err error) {
for _, hit := range hits {
doc, err := indexReader.Document(hit.ID)
if err == nil {
if err == nil && doc != nil {
highlightFields := req.Highlight.Fields
if highlightFields == nil {
// add all fields with matches
@ -459,6 +459,10 @@ func (i *indexImpl) Search(req *SearchRequest) (sr *SearchResult, err error) {
for _, hf := range highlightFields {
highlighter.BestFragmentsInField(hit, doc, hf, 1)
}
} else if err == nil {
// unexpected case, a doc ID that was found as a search hit
// was unable to be found during document lookup
panic(fmt.Sprintf("search hit with doc id: '%s' not found in doc lookup", hit.ID))
}
}
}