Skip to content
  • Maintainer

    I was thinking of a structure like this:

    • top level and requirements:
      • search term
      • group searched
    • top level or requirements
      • visibility: public or internal visibility and repository: enabled
      • visibility: public or internal and repository: enabled or private, groups/projects that user has guest role OR another role with read_code permissions
      • visibility: private and repository: enabled or private, groups/projects that user has repository role OR another role with read_code permissions
    {
      "version": 2,
      "timeout": "30s",
      "num_context_lines": 20,
      "max_file_match_window": 1000,
      "max_file_match_results": 5,
      "max_line_match_window": 500,
      "max_line_match_results": 10,
      "max_line_match_results_per_file": 3,
      "forward_to": [
        {
          "endpoint": "http://localhost:6090/api/search",
          "query": {
            "and": {
              "children": [
                {
                  "query_string": {
                    "query": "test"
                  }
                },
                {
                  "meta": {
                    "key": "traversal_ids",
                    "value": "^9970-"
                  }
                }
              ]
            },
            "or": {
              "children": [
                {
                  "and": {
                    "children": [
                      {
                        "meta": {
                          "key": "repository_access_level",
                          "value": 20
                        }
                      },
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "visibility_level",
                                "value": 10
                              }
                            },
                            {
                              "meta": {
                                "key": "visibility_level",
                                "value": 20
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                {
                  "and": {
                    "children": [
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "visibility_level",
                                "value": 10
                              }
                            },
                            {
                              "meta": {
                                "key": "visibility_level",
                                "value": 20
                              }
                            }
                          ]
                        }
                      },
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "repository_access_level",
                                "value": 10
                              }
                            },
                            {
                              "meta": {
                                "key": "repository_access_level",
                                "value": 20
                              }
                            }
                          ]
                        }
                      },
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "traversal_ids",
                                "value": "9970-457-"
                              }
                            },
                            {
                              "meta": {
                                "key": "traversal_ids",
                                "value": "9970-123-"
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                {
                  "and": {
                    "children": [
                      {
                        "meta": {
                          "key": "visibility_level",
                          "value": 0
                        }
                      },
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "repository_access_level",
                                "value": 10
                              }
                            },
                            {
                              "meta": {
                                "key": "repository_access_level",
                                "value": 20
                              }
                            }
                          ]
                        }
                      },
                      {
                        "or": {
                          "children": [
                            {
                              "meta": {
                                "key": "traversal_ids",
                                "value": "9970-234-789-"
                              }
                            },
                            {
                              "meta": {
                                "key": "repo_ids",
                                "value": [1, 56, 99]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        }
      ]
    }
  • Author Maintainer

    This is tremendously helpful, thank you @terrichu! I'll give this a go. 🤝

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment