I think it would be useful and make sense to add a position to the Documents
This is not necessary for the search itself, but for the front ends that should work with the retrieved Documents.
Consider a front-end that wants to render the Documents position, just like the hunt-server front-end right now. It needs the position data! For the demo i just added two extra fields to the general description.
Having a separate property would allow to write general functions for Document positions.
data Document = Document
{ uri :: ! URI -- ^ Unique identifier of the document.
, desc :: ! Description -- ^ Description of the document (simple key-value store).
, wght :: ! Score -- ^ Weight used in ranking (default @1.0@).
, pos :: ! Maybe Position -- ^ Optional document position
}
deriving (Show, Eq)
I think it would be useful and make sense to add a position to the
Document
sThis is not necessary for the search itself, but for the front ends that should work with the retrieved
Document
s.Consider a front-end that wants to render the
Document
s position, just like the hunt-server front-end right now. It needs the position data! For the demo i just added two extra fields to the generaldescription
.Having a separate property would allow to write general functions for
Document
positions.