#community-help

Troubleshooting Typesense Query Issues

TLDR Ralf had an issue with no results for a Typesense query. Jason solved it by advising the version number should match in both the document and query.

Powered by Struct AI
Oct 29, 2022 (14 months ago)
Ralf
Photo of md5-4d46f15fe7c5e8556f1d7d11a045dbf8
Ralf
10:54 AM
Hi all,

currently I setup search for a web page with Typesense. I already have to server running and scrapped my page. There are 5327 documents added to my collection "antora-docs".
When I query the collection (either via web interface or Rest API containing a filter that is an asterix or a concret term) I'm not able to get any results back.
I added information about my collection, an example document and the multi_search body.

Anyone with an idea what's going on or what I can do to get results?

Collection information (5327 documents):

{
    "created_at": 1667035078,
    "default_sorting_field": "item_priority",
    "fields": [
        {
            "facet": false,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "anchor",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": false,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "content",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "url",
            "optional": false,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "version",
            "optional": true,
            "sort": false,
            "type": "string[]"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl0",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl1",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl2",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl3",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl4",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl5",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "hierarchy.lvl6",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": ".*_tag",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "language",
            "optional": true,
            "sort": false,
            "type": "string"
        },
        {
            "facet": true,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "tags",
            "optional": true,
            "sort": false,
            "type": "string[]"
        },
        {
            "facet": false,
            "index": true,
            "infix": false,
            "locale": "",
            "name": "item_priority",
            "optional": false,
            "sort": true,
            "type": "int64"
        }
    ],
    "name": "antora-docs_1667035078",
    "num_documents": 5327,
    "symbols_to_index": [],
    "token_separators": []
}

Document example:
GET: /collections/antora-docs/documents/25

{
    "component": "redshift-datavault",
    "content": "This article was moved to Zendesk",
    "content_camel": "This article was moved to Zendesk",
    "hierarchy": {
        "lvl0": "Redshift Data Vault latest",
        "lvl1": "External Configuration for Connection Attributes",
        "lvl2": null,
        "lvl3": null,
        "lvl4": null,
        "lvl5": null,
        "lvl6": null
    },
    "hierarchy.lvl0": "Redshift Data Vault latest",
    "hierarchy.lvl1": "External Configuration for Connection Attributes",
    "hierarchy_camel": [
        {
            "lvl0": "Redshift Data Vault latest",
            "lvl1": "External Configuration for Connection Attributes",
            "lvl2": null,
            "lvl3": null,
            "lvl4": null,
            "lvl5": null,
            "lvl6": null
        }
    ],
    "hierarchy_radio": {
        "lvl0": null,
        "lvl1": null,
        "lvl2": null,
        "lvl3": null,
        "lvl4": null,
        "lvl5": null
    },
    "hierarchy_radio_camel": {
        "lvl0": null,
        "lvl1": null,
        "lvl2": null,
        "lvl3": null,
        "lvl4": null,
        "lvl5": null
    },
    "id": "25",
    "item_priority": 1,
    "no_variables": false,
    "objectID": "83dde568c42f117cfdbd12b76b6aa96e59d114e3",
    "tags": [],
    "type": "content",
    "url": "",
    "url_without_anchor": "",
    "url_without_variables": "",
    "version": [
        "latest"
    ],
    "weight": {
        "level": 0,
        "page_rank": 0,
        "position": 1
    }
}

When i run a multi search I do not get any matches:
POST: /multi_search

{
    "searches": [
        {
            "collection": "antora-docs",
            "q": "redshift",
            "query_by": "hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",
            "include_fields": "hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content,anchor,url,type,id",
            "highlight_full_fields": "hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",
            "group_by": "url",
            "group_limit": 3,
            "filter_by": "version:=0.21.0"
        }
    ]
}

Response:

{
    "results": [
        {
            "facet_counts": [],
            "found": 0,
            "grouped_hits": [],
            "out_of": 5327,
            "page": 1,
            "request_params": {
                "collection_name": "antora-docs_1667035078",
                "per_page": 10,
                "q": "redshift"
            },
            "search_cutoff": false,
            "search_time_ms": 0
        }
    ]
}

Even if i query with an asterix, the response is empty. Anyone with an idea what's going on or what I can do to get results?


``````
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:44 PM
In the query I see "filter_by": "version:=0.21.0", but in your document you have:

"version": [
        "latest"
    ],

You’d need to specify the version in a meta tag
06:45
Jason
06:45 PM
Ralf ^
Nov 02, 2022 (14 months ago)
Ralf
Photo of md5-4d46f15fe7c5e8556f1d7d11a045dbf8
Ralf
07:58 AM
Thanks a lot Jason. Somehow, I misunderstood the concept of the version in this case ¯\_(ツ)_/¯