Skip to content

Commit

Permalink
#1861 Remove whole text index on potential large text field
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 22, 2021
1 parent a9242e4 commit dfc13e5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Alert.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ case class AlertTag()
@DefineIndex(IndexType.standard, "source")
@DefineIndex(IndexType.standard, "sourceRef")
@DefineIndex(IndexType.fulltext, "title")
@DefineIndex(IndexType.fulltext, "description")
@DefineIndex(IndexType.fulltextOnly, "description")
@DefineIndex(IndexType.standard, "severity")
@DefineIndex(IndexType.standard, "date")
@DefineIndex(IndexType.standard, "lastSyncDate")
Expand Down
4 changes: 2 additions & 2 deletions thehive/app/org/thp/thehive/models/Case.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ case class CaseProcedure()
@BuildVertexEntity
@DefineIndex(IndexType.unique, "number")
@DefineIndex(IndexType.fulltext, "title")
@DefineIndex(IndexType.fulltext, "description")
@DefineIndex(IndexType.fulltextOnly, "description")
@DefineIndex(IndexType.standard, "severity")
@DefineIndex(IndexType.standard, "startDate")
@DefineIndex(IndexType.standard, "endDate")
@DefineIndex(IndexType.standard, "flag")
@DefineIndex(IndexType.standard, "tlp")
@DefineIndex(IndexType.standard, "pap")
@DefineIndex(IndexType.standard, "status")
@DefineIndex(IndexType.fulltext, "summary")
@DefineIndex(IndexType.fulltextOnly, "summary")
@DefineIndex(IndexType.standard, "tags")
@DefineIndex(IndexType.standard, "assignee")
@DefineIndex(IndexType.standard, "organisationIds")
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Log.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.util.Date
@BuildEdgeEntity[Log, Attachment]
case class LogAttachment()

@DefineIndex(IndexType.fulltext, "message")
@DefineIndex(IndexType.fulltextOnly, "message")
@DefineIndex(IndexType.standard, "date")
@DefineIndex(IndexType.standard, "taskId")
@DefineIndex(IndexType.standard, "organisationIds")
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 @@ -17,7 +17,7 @@ case class ObservableData()
@BuildEdgeEntity[Observable, Tag]
case class ObservableTag()

@DefineIndex(IndexType.fulltext, "message")
@DefineIndex(IndexType.fulltextOnly, "message")
@DefineIndex(IndexType.standard, "tlp")
@DefineIndex(IndexType.standard, "ioc")
@DefineIndex(IndexType.standard, "sighted")
Expand Down
3 changes: 2 additions & 1 deletion thehive/app/org/thp/thehive/models/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import org.thp.scalligraph.BuildVertexEntity
import org.thp.scalligraph.models.{DefineIndex, IndexType}

@DefineIndex(IndexType.unique, "namespace", "predicate", "value")
@DefineIndex(IndexType.fulltext, "namespace", "predicate", "value", "description")
@DefineIndex(IndexType.fulltext, "namespace", "predicate", "value")
@DefineIndex(IndexType.fulltextOnly, "description")
@BuildVertexEntity
case class Tag(
namespace: String,
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/models/Task.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ case class TaskLog()
@BuildVertexEntity
@DefineIndex(IndexType.fulltext, "title")
@DefineIndex(IndexType.standard, "group")
@DefineIndex(IndexType.fulltext, "description")
@DefineIndex(IndexType.fulltextOnly, "description")
@DefineIndex(IndexType.standard, "status")
@DefineIndex(IndexType.standard, "flag")
@DefineIndex(IndexType.standard, "startDate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,14 @@ class TheHiveSchemaDefinition @Inject() extends Schema with UpdatableSchema {
traversal.outE("OrganisationDashboard").raw.property("writable", true).iterate()
Success(())
}
//=====[release 4.1.0]=====
.removeIndex("Alert", IndexType.fulltext, "description")
.removeIndex("Case", IndexType.fulltext, "description", "summary")
.removeIndex("Log", IndexType.fulltext, "message")
.removeIndex("Observable", IndexType.fulltext, "message")
.removeIndex("Log", IndexType.fulltext, "message")
.removeIndex("Tag", IndexType.fulltext, "description")
.removeIndex("Task", IndexType.fulltext, "description")

val reflectionClasses = new Reflections(
new ConfigurationBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class StatusCtrlTest extends PlaySpecification with TestAppBuilder {
"pollingDuration" -> 1000
),
"schemaStatus" -> Json.arr(
Json.obj("name" -> "thehive", "currentVersion" -> 59, "expectedVersion" -> 59, "error" -> JsNull)
Json.obj("name" -> "thehive", "currentVersion" -> 66, "expectedVersion" -> 66, "error" -> JsNull)
)
)

Expand Down

0 comments on commit dfc13e5

Please sign in to comment.