Skip to content

search: listing all tags transfers every tagged resource from the search engine #3890

Open

Description

@pbleser-oc

To list the tags in use, graph's GetTags searches for Tags:* with PageSize: -1 and only uses the tags of the results. The search service fetches every tagged resource the user can access from the engine, with all its fields, in every space, and sends them all to graph. That needlessly costs memory and bandwidth in the search engine, the search service and graph, growing with the number of tagged files.

There is also an inconsistency between the engines: with PageSize: -1, bleve returns all hits, while OpenSearch stops at 1000 hits per space. So with OpenSearch, tags that only occur beyond those 1000 resources are missing from the list.

Possible fix: let the search engines aggregate the tags themselves. The Tags field is already indexed as a keyword with doc values in both engines, so no mapping change or reindex is needed:

  • a flag and limit on SearchRequest and SearchIndexRequest that ask for tag aggregation, and a tags list in the responses;
  • bleve: a terms facet on Tags with no hits returned; OpenSearch: a terms aggregation with size: 0;
  • the search service merges the tags per space, using the same space, share and path restrictions as a normal search;
  • graph uses the aggregated tags instead of the hits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions