Skip to content

Commit

Permalink
#1914 Optimise tags query
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 8, 2021
1 parent d2f80d6 commit b8e4792
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
pageSize: self.filtering.context.pageSize,
filter: this.filtering.buildQuery(),
operations: [
{
'_name': 'listTag'
},
{
'_name': 'freetags'
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/app/scripts/services/api/TagSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
self.tagsDefaultColour = defaultColour;

return QuerySrv.query('v1', [
{ _name: 'listTag' },
{ _name: 'freetags' },
{ _name: 'filter', _not: { '_field': 'colour', '_value': defaultColour } }
{ _name: 'filter', _ne: { '_field': 'colour', '_value': defaultColour } }
], {
params: {
name: 'list-tags'
Expand Down
1 change: 1 addition & 0 deletions thehive/app/org/thp/thehive/controllers/v1/TagCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TagCtrl @Inject() (
(idOrName, graph, _) => tagSrv.get(idOrName)(graph)
)
override val extraQueries: Seq[ParamQuery[_]] = Seq(
Query.init[Traversal.V[Tag]]("freetags", (graph, authContext) => tagSrv.startTraversal(graph).freetags(organisationSrv)(authContext)),
Query[Traversal.V[Tag], Traversal.V[Tag]]("freetags", (tagSteps, authContext) => tagSteps.freetags(organisationSrv)(authContext)),
Query.initWithParam[TagHint, Traversal[String, Vertex, Converter[String, Vertex]]](
"tagAutoComplete",
Expand Down
1 change: 1 addition & 0 deletions thehive/app/org/thp/thehive/models/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.thp.scalligraph.models.{DefineIndex, IndexType}

@DefineIndex(IndexType.unique, "namespace", "predicate", "value")
@DefineIndex(IndexType.fulltext, "namespace", "predicate", "value")
@DefineIndex(IndexType.standard, "colour")
@DefineIndex(IndexType.fulltextOnly, "description")
@BuildVertexEntity
case class Tag(
Expand Down

0 comments on commit b8e4792

Please sign in to comment.