Open pavel1337 opened 3 years ago
So, DocValues is different from stored values. DocValues are used for sorting and aggregating. Stored values are not used internally by bluge for anything, the only thing we can do is return the back to you.
Your existing use of VisitStoredFields looks correct, it's just that you're not storing the value. You should add a call to StoreValue()
when building the field. Something like:
doc.AddField(bluge.NewTextField("name", c.name).StoreValue())
Seems like it is not in the latest available go module which is 0.1.5 for me.
UPD: sorry, overlooked parenthesis order =)
Thank you for the response, going to continue exploring!
I got bitten by this too. I thin the docs and website should be updated to refeclt this. It wasn't obvious to me at first to call .StoreValue()
on the fields I'm adding. Thanks!
Hi! Just started learning this tool few hours ago. Could not find a way to access stored fields. So I have a slice of objects, it is quite huge, but for example I have added only two here. I can easily get the
_id
field, but the fieldname
is empty when I try too get it withmatch.DocValues("name")
, or non-existent when I just trying to print all stored fields.Am I overlooking something here?
Code:
Output: