mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Make data to index more flexible and extensible
This commit is contained in:
@ -2,4 +2,55 @@ package docspell.ftsclient
|
||||
|
||||
import docspell.common._
|
||||
|
||||
final case class TextData(item: Ident, attachment: Ident, collective: Ident, text: String)
|
||||
sealed trait TextData {
|
||||
|
||||
def id: Ident
|
||||
|
||||
def item: Ident
|
||||
|
||||
def collective: Ident
|
||||
|
||||
}
|
||||
|
||||
object TextData {
|
||||
|
||||
final case class Attachment(
|
||||
item: Ident,
|
||||
attachId: Ident,
|
||||
collective: Ident,
|
||||
name: Option[String],
|
||||
text: Option[String]
|
||||
) extends TextData {
|
||||
|
||||
val id = item / attachId
|
||||
|
||||
}
|
||||
|
||||
def attachment(
|
||||
item: Ident,
|
||||
attachId: Ident,
|
||||
collective: Ident,
|
||||
name: Option[String],
|
||||
text: Option[String]
|
||||
): TextData =
|
||||
Attachment(item, attachId, collective, name, text)
|
||||
|
||||
final case class Item(
|
||||
item: Ident,
|
||||
collective: Ident,
|
||||
name: Option[String],
|
||||
notes: Option[String]
|
||||
) extends TextData {
|
||||
|
||||
val id = Ident.unsafe("item") / item
|
||||
|
||||
}
|
||||
|
||||
def item(
|
||||
item: Ident,
|
||||
collective: Ident,
|
||||
name: Option[String],
|
||||
notes: Option[String]
|
||||
): TextData =
|
||||
Item(item, collective, name, notes)
|
||||
}
|
||||
|
Reference in New Issue
Block a user