Skip to content

Commit

Permalink
#1404 Rebuild indexes to ensure their proper use
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jun 28, 2020
1 parent 0d66d0d commit fedaa44
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ class Output @Inject() (
.flatMap(_ => cortexSchema.update(db)(LocalUserSrv.getSystemAuthContext))
.map { _ =>
retrieveExistingData()
db match {
case jdb: JanusDatabase => jdb.removeAllIndexes()
case _ =>
}
db.removeAllIndexes()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Case.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ case class CaseUser()
case class CaseCaseTemplate()

@VertexEntity
@DefineIndex(IndexType.tryUnique, "number")
@DefineIndex(IndexType.unique, "number")
//@DefineIndex(IndexType.fulltext, "title")
//@DefineIndex(IndexType.fulltext, "description")
//@DefineIndex(IndexType.standard, "startDate")
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Observable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ case class RichObservable(
def sighted: Boolean = observable.sighted
}

@DefineIndex(IndexType.tryUnique, "data")
@DefineIndex(IndexType.unique, "data")
@VertexEntity
case class Data(data: String)
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import play.api.Logger
import scala.util.Try
import scala.util.matching.Regex

@DefineIndex(IndexType.tryUnique, "namespace", "predicate", "value")
@DefineIndex(IndexType.unique, "namespace", "predicate", "value")
@VertexEntity
case class Tag(
namespace: String,
Expand Down
1 change: 1 addition & 0 deletions thehive/app/org/thp/thehive/services/DatabaseWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class DatabaseWrapper(dbProvider: Provider[Database]) extends Database {
override def addSchemaIndexes(model: Model, models: Model*): Try[Unit] = db.addSchemaIndexes(model, models: _*)
override def addSchemaIndexes(models: Seq[Model]): Try[Unit] = db.addSchemaIndexes(models)
override def enableIndexes(): Try[Unit] = db.enableIndexes()
override def removeAllIndexes(): Unit = db.removeAllIndexes()
override def addProperty[T](model: String, propertyName: String, mapping: Mapping[_, _, _]): Try[Unit] =
db.addProperty(model, propertyName, mapping)
override def removeProperty(model: String, propertyName: String, usedOnlyByThisModel: Boolean): Try[Unit] =
Expand Down

0 comments on commit fedaa44

Please sign in to comment.