IDR / idr-gallery

Home Page:https://pypi.org/project/idr-gallery/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Complex queries

will-moore opened this issue · comments

The searchengine backend supports complex nested queries, but we haven't exposed this in the UI yet.

The main missing feature is the support for converting this query into a URL

Currently have this working, but needs improved UI tweaks:

Screenshot 2023-05-12 at 10 05 13

This query generated is:

{
  "resource": "image",
  "query_details": {
    "and_filters": [
      {
        "name": "Gene Symbol",
        "value": "pdx1",
        "operator": "contains",
        "resource": "image"
      },
      {
        "name": "Pathology",
        "value": "carcinoid, malignant, nos",
        "operator": "contains",
        "resource": "image"
      }
    ],
    "or_filters": [
      [
        {
          "name": "Organism Part",
          "value": "small intestine",
          "operator": "contains",
          "resource": "image"
        },
        {
          "name": "Organism Part",
          "value": "duodenum",
          "operator": "contains",
          "resource": "image"
        }
      ]
    ],
    "case_sensitive": false
  },
  "mode": "searchterms"
}

Using jsonurl library, this gives a URL for the query above like:

idr_gallery/search/?q=(((key:Organism+Part,value:small+intestine,operator:contains,resource:image),
(key:Organism+Part,value:duodenum,operator:contains,resource:image)),
(key:Gene+Symbol,value:pdx1,operator:contains,resource:image),
(key:Pathology,value:carcinoid!,+malignant!,+nos,operator:contains,resource:image))

@sbesson noted that query string is limited to 4k characters on most servers.
The query above is 292 characters, so we are a good way off reaching that limit, but good to keep in mind.