diff --git a/README.md b/README.md index 1f35706..d541bf8 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ Computationally focused database using pluggable stores To add all modules: ```scala -libraryDependencies += "com.outr" %% "lightdb-all" % "1.2.1" +libraryDependencies += "com.outr" %% "lightdb-all" % "1.2.2" ``` For a specific implementation like Lucene: ```scala -libraryDependencies += "com.outr" %% "lightdb-lucene" % "1.2.1" +libraryDependencies += "com.outr" %% "lightdb-lucene" % "1.2.2" ``` ## Videos @@ -52,7 +52,7 @@ Ensure you have the following: Add the following dependency to your `build.sbt` file: ```scala -libraryDependencies += "com.outr" %% "lightdb-all" % "1.2.1" +libraryDependencies += "com.outr" %% "lightdb-all" % "1.2.2" ``` --- @@ -128,7 +128,7 @@ Instantiate and initialize the database: ```scala val db = new DB -// db: DB = repl.MdocSession$MdocApp$DB@6ea5d267 +// db: DB = repl.MdocSession$MdocApp$DB@6e580455 db.init() // res0: Boolean = true ``` @@ -145,7 +145,7 @@ val adam = Person(name = "Adam", age = 21) // city = None, // nicknames = Set(), // friends = List(), -// _id = Id(value = "BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr") +// _id = Id(value = "RgelUWnuRJLktKoZMOwivwanvRhRWSoT") // ) db.people.transaction { implicit transaction => db.people.insert(adam) @@ -156,7 +156,7 @@ db.people.transaction { implicit transaction => // city = None, // nicknames = Set(), // friends = List(), -// _id = Id(value = "BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr") +// _id = Id(value = "RgelUWnuRJLktKoZMOwivwanvRhRWSoT") // ) ``` @@ -169,7 +169,7 @@ db.people.transaction { implicit transaction => val peopleIn20s = db.people.query.filter(_.age BETWEEN 20 -> 29).toList println(peopleIn20s) } -// List(Person(Adam,21,None,Set(),List(),Id(V4HuAlFgFWP0bARChPFtCx5eqMCvtX7l)), Person(Adam,21,None,Set(),List(),Id(xxVmia6PxlkFL1nWWDNFKiO2KccbDrhv)), Person(Adam,21,None,Set(),List(),Id(eaQIHd0ZiDHjxWa9VXzhybMHWtH80C47)), Person(Adam,21,None,Set(),List(),Id(Mg3nibsB1wstqK1xEIiGNeU4Q5iw7Kfc)), Person(Adam,21,None,Set(),List(),Id(bKaLE07r8AzMoAjBotiP0dDfo9n96I1q)), Person(Adam,21,None,Set(),List(),Id(Kq2SaCpZ7spHyMnYT2IvmpbynonZEBR2)), Person(Adam,21,None,Set(),List(),Id(lWJ5yg8AquThmEQ5yoRVOTrVzpfAP4II)), Person(Adam,21,None,Set(),List(),Id(mF9hZfb8wM4meAcQeUKfAdZ75dELpE81)), Person(Adam,21,None,Set(),List(),Id(KX7pnHxh7qet74BmcULK6XK9lkcxnTCc)), Person(Adam,21,None,Set(),List(),Id(4dsT7zjp8OTm2i6RoKVCrYlsjXKvtXHe)), Person(Adam,21,None,Set(),List(),Id(BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr))) +// List(Person(Adam,21,None,Set(),List(),Id(V4HuAlFgFWP0bARChPFtCx5eqMCvtX7l)), Person(Adam,21,None,Set(),List(),Id(xxVmia6PxlkFL1nWWDNFKiO2KccbDrhv)), Person(Adam,21,None,Set(),List(),Id(eaQIHd0ZiDHjxWa9VXzhybMHWtH80C47)), Person(Adam,21,None,Set(),List(),Id(Mg3nibsB1wstqK1xEIiGNeU4Q5iw7Kfc)), Person(Adam,21,None,Set(),List(),Id(bKaLE07r8AzMoAjBotiP0dDfo9n96I1q)), Person(Adam,21,None,Set(),List(),Id(Kq2SaCpZ7spHyMnYT2IvmpbynonZEBR2)), Person(Adam,21,None,Set(),List(),Id(lWJ5yg8AquThmEQ5yoRVOTrVzpfAP4II)), Person(Adam,21,None,Set(),List(),Id(mF9hZfb8wM4meAcQeUKfAdZ75dELpE81)), Person(Adam,21,None,Set(),List(),Id(KX7pnHxh7qet74BmcULK6XK9lkcxnTCc)), Person(Adam,21,None,Set(),List(),Id(4dsT7zjp8OTm2i6RoKVCrYlsjXKvtXHe)), Person(Adam,21,None,Set(),List(),Id(BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr)), Person(Adam,21,None,Set(),List(),Id(RgelUWnuRJLktKoZMOwivwanvRhRWSoT))) ``` --- @@ -204,7 +204,7 @@ db.people.transaction { implicit transaction => .toList println(results) } -// List(MaterializedAggregate({"ageMin": 21, "ageMax": 21, "ageAvg": 21.0, "ageSum": 231},repl.MdocSession$MdocApp$Person$@15575c57)) +// List(MaterializedAggregate({"ageMin": 21, "ageMax": 21, "ageAvg": 21.0, "ageSum": 252},repl.MdocSession$MdocApp$Person$@8caf39)) ``` ### Grouping @@ -214,7 +214,7 @@ db.people.transaction { implicit transaction => val grouped = db.people.query.grouped(_.age).toList println(grouped) } -// List((21,List(Person(Adam,21,None,Set(),List(),Id(V4HuAlFgFWP0bARChPFtCx5eqMCvtX7l)), Person(Adam,21,None,Set(),List(),Id(xxVmia6PxlkFL1nWWDNFKiO2KccbDrhv)), Person(Adam,21,None,Set(),List(),Id(eaQIHd0ZiDHjxWa9VXzhybMHWtH80C47)), Person(Adam,21,None,Set(),List(),Id(Mg3nibsB1wstqK1xEIiGNeU4Q5iw7Kfc)), Person(Adam,21,None,Set(),List(),Id(bKaLE07r8AzMoAjBotiP0dDfo9n96I1q)), Person(Adam,21,None,Set(),List(),Id(Kq2SaCpZ7spHyMnYT2IvmpbynonZEBR2)), Person(Adam,21,None,Set(),List(),Id(lWJ5yg8AquThmEQ5yoRVOTrVzpfAP4II)), Person(Adam,21,None,Set(),List(),Id(mF9hZfb8wM4meAcQeUKfAdZ75dELpE81)), Person(Adam,21,None,Set(),List(),Id(KX7pnHxh7qet74BmcULK6XK9lkcxnTCc)), Person(Adam,21,None,Set(),List(),Id(4dsT7zjp8OTm2i6RoKVCrYlsjXKvtXHe)), Person(Adam,21,None,Set(),List(),Id(BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr))))) +// List((21,List(Person(Adam,21,None,Set(),List(),Id(V4HuAlFgFWP0bARChPFtCx5eqMCvtX7l)), Person(Adam,21,None,Set(),List(),Id(xxVmia6PxlkFL1nWWDNFKiO2KccbDrhv)), Person(Adam,21,None,Set(),List(),Id(eaQIHd0ZiDHjxWa9VXzhybMHWtH80C47)), Person(Adam,21,None,Set(),List(),Id(Mg3nibsB1wstqK1xEIiGNeU4Q5iw7Kfc)), Person(Adam,21,None,Set(),List(),Id(bKaLE07r8AzMoAjBotiP0dDfo9n96I1q)), Person(Adam,21,None,Set(),List(),Id(Kq2SaCpZ7spHyMnYT2IvmpbynonZEBR2)), Person(Adam,21,None,Set(),List(),Id(lWJ5yg8AquThmEQ5yoRVOTrVzpfAP4II)), Person(Adam,21,None,Set(),List(),Id(mF9hZfb8wM4meAcQeUKfAdZ75dELpE81)), Person(Adam,21,None,Set(),List(),Id(KX7pnHxh7qet74BmcULK6XK9lkcxnTCc)), Person(Adam,21,None,Set(),List(),Id(4dsT7zjp8OTm2i6RoKVCrYlsjXKvtXHe)), Person(Adam,21,None,Set(),List(),Id(BzUQdoR76YpFIwxdGpG3kR6WMLvNZxPr)), Person(Adam,21,None,Set(),List(),Id(RgelUWnuRJLktKoZMOwivwanvRhRWSoT))))) ``` --- @@ -228,14 +228,14 @@ import lightdb.backup._ import java.io.File DatabaseBackup.archive(db, new File("backup.zip")) -// res5: Int = 12 +// res5: Int = 13 ``` Restore from a backup: ```scala DatabaseRestore.archive(db, new File("backup.zip")) -// res6: Int = 12 +// res6: Int = 13 ``` --- diff --git a/build.sbt b/build.sbt index 07ac915..e68a2f3 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,7 @@ val developerURL: String = "https://matthicks.com" name := projectName ThisBuild / organization := org -ThisBuild / version := "1.2.1" +ThisBuild / version := "1.2.2" ThisBuild / scalaVersion := scala213 ThisBuild / crossScalaVersions := allScalaVersions ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation") @@ -64,7 +64,7 @@ val mapdbVersion: String = "3.1.0" val jedisVersion: String = "5.2.0" -val fabricVersion: String = "1.15.5" +val fabricVersion: String = "1.15.6" val scribeVersion: String = "3.15.3" diff --git a/core/src/main/scala/lightdb/doc/RecordDocumentModel.scala b/core/src/main/scala/lightdb/doc/RecordDocumentModel.scala index c744baf..b353bf4 100644 --- a/core/src/main/scala/lightdb/doc/RecordDocumentModel.scala +++ b/core/src/main/scala/lightdb/doc/RecordDocumentModel.scala @@ -4,18 +4,6 @@ import fabric.rw._ import lightdb.field.Field trait RecordDocumentModel[Doc <: RecordDocument[Doc]] extends DocumentModel[Doc] { - protected def indexCreated: Boolean = false - protected def indexModified: Boolean = false - - val created: Field[Doc, Long] = if (indexCreated) { - field.index("created", (doc: Doc) => doc.created) - } else { - field("created", (doc: Doc) => doc.created) - } - - val modified: Field[Doc, Long] = if (indexModified) { - field.index("modified", (doc: Doc) => doc.modified) - } else { - field("modified", (doc: Doc) => doc.modified) - } -} + val created: I[Long] = field.index("created", (doc: Doc) => doc.created) + val modified: I[Long] = field.index("modified", (doc: Doc) => doc.modified) +} \ No newline at end of file