mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Initial module setup
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
package docspell.ftsclient
|
||||
|
||||
import cats.data.NonEmptyList
|
||||
import cats.implicits._
|
||||
import docspell.common._
|
||||
|
||||
import FtsBasicResult.AttachmentMatch
|
||||
|
||||
final case class FtsBasicResult(item: Ident, attachments: NonEmptyList[AttachmentMatch]) {
|
||||
|
||||
def score: Double =
|
||||
attachments.map(_.score).toList.max
|
||||
}
|
||||
|
||||
object FtsBasicResult {
|
||||
|
||||
case class AttachmentMatch(id: Ident, score: Double)
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package docspell.ftsclient
|
||||
|
||||
import fs2.Stream
|
||||
|
||||
/** The fts client is the interface for docspell to a fulltext search
|
||||
* engine.
|
||||
*
|
||||
* It defines all operations required for integration into docspell.
|
||||
* It uses data structures and terms of docspell. Implementation
|
||||
* modules need to translate it to the engine that provides the
|
||||
* features.
|
||||
*/
|
||||
trait FtsClient[F[_]] {
|
||||
|
||||
def searchBasic(q: FtsQuery): Stream[F, FtsBasicResult]
|
||||
|
||||
def indexData(data: TextData): F[Unit]
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package docspell.ftsclient
|
||||
|
||||
import docspell.common._
|
||||
|
||||
/** A fulltext query.
|
||||
*
|
||||
* The query itself is a raw string. Each implementation may
|
||||
* interpret it according to the system in use.
|
||||
*/
|
||||
final case class FtsQuery(q: String, collective: Ident, limit: Int, offset: Int)
|
@ -0,0 +1,5 @@
|
||||
package docspell.ftsclient
|
||||
|
||||
import docspell.common._
|
||||
|
||||
final case class TextData(item: Ident, attachment: Ident, collective: Ident, text: String)
|
Reference in New Issue
Block a user