#community-help

`_eval` Functionality on String Parameters

TLDR Tulika reported trouble using _eval on string parameters. Harpreet identified the issue as a bug fixed in version 0.26 and guided Tulika to the release candidate build.

Powered by Struct AI

1

Oct 25, 2023 (1 month ago)
Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
06:50 AM
Hi! I am able to apply _eval on multiple parameters with datatype: int 32 , but not able to do the same with string parameters in _eval . Detailed example below->
search_parameters = {
        'q': 'Harry',
        'query_by': 'title',
        'per_page': '100',
        'sort_by': '_eval(publication_year:[2007,2001]):desc,_text_match:desc'
    }

this is working fine as the hits with publication year 2007 and 2001 comes up in the beginning of the hits.

search_parameters = {
        'q': 'Harry',
        'query_by': 'title',
        'per_page': '100',
        'sort_by': '_eval(title:[Harry Potter and the Cursed Child,Harry Potter and the Prisoner of Azkaban]):desc,_text_match:desc'
    }

but this is showing error -> typesense.exceptions.ObjectNotFound: [Errno 404] Could not find a field named _eval(title in the schema for sorting.
publication_year is of int32 datatype
title is of string datatype
does anybody know how can I solve this?.
Oct 26, 2023 (1 month ago)
Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
06:51 AM
Hey!. Is there any solution for this?
Harpreet
Photo of md5-745d880d794220d9f0fb9ade17c6b861
Harpreet
08:15 AM
Hey Tulika Which Typesense version are you using?
08:17
Harpreet
08:17 AM
Also, does this work fine?
'sort_by': '_eval(title:Harry Potter and the Cursed Child):desc,_text_match:desc'

Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
11:10 AM
using 0.25.1
11:12
Tulika
11:12 AM
and yes
'sort_by': '_eval(title:Harry Potter and the Cursed Child):desc,_text_match:desc'

this works fine.

1

Harpreet
Photo of md5-745d880d794220d9f0fb9ade17c6b861
Harpreet
11:13 AM
> using 0.25.1
We've fixed this bug in 0.26
https://github.com/typesense/typesense/pull/1192
Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
11:16 AM
is it 0.26 version released?
Harpreet
Photo of md5-745d880d794220d9f0fb9ade17c6b861
Harpreet
11:17 AM
Not yet, but you can use an RC build.
Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
11:22 AM
From where Can I download it and any doc to how to run it. Also what is the expected release date for 0.26 version?
Harpreet
Photo of md5-745d880d794220d9f0fb9ade17c6b861
Harpreet
11:25 AM
Do you use docker?
Tulika
Photo of md5-0da80c6202e2e83df3905cf0cd066c6c
Tulika
11:25 AM
yes
Harpreet
Photo of md5-745d880d794220d9f0fb9ade17c6b861
Harpreet
11:26 AM
https://hub.docker.com/r/typesense/typesense/tags
0.26.0.rc25 is the latest RC build.

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Methods for Fetching, Querying, and Modifying Collections in Typesense

Bill inquired about performing OR queries, querying empty arrays and modifying collections in Typesense. Kishore Nallan explained the current limitations and provided workarounds and recommendations for each case. The conversation also touched upon the usage of cache in Typesense and the workings of the _eval function.

5

52
10mo

Document Weighting and Sorting Discussion

SamHendley asked how to weight a document based on age and offered a sorting method. Jason clarified the method and suggested an RC for use. SamHendley tested and confirmed the solution. User Kishore Nallan assisted when an error occurred with a new feature.

1

30
12mo

Troubleshooting Issues with DocSearch Hits and Scraper Configuration

Rubai encountered issues with search result priorities and ellipsis. Jason helped debug the issue and suggested using different versions of typesense-docsearch.js, updating initialization parameters, and running the scraper on a Linux-based environment. The issues related to hits structure and scraper configuration were resolved.

7

131
8mo

Docsearch Scrapper Metadata Configuration and Filter Problem

Marcos faced issues with Docsearch scrapper not adding metadata attributes and filtering out documents without content. Jason helped fix the issue by updating the scraper and providing filtering instructions.

2

82
8mo

Phrase Search Relevancy and Weights Fix

Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.

6

111
8mo