PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 5, 2022

[FIXED] How to set LIMIT property with redis ft.SEARCH in TypeScript

 September 05, 2022     redis, typescript     No comments   

Issue

code

  client.ft.SEARCH('license-index-json',"@\\$\\" + ".reservedForApplicationName:GSTest",{
    LIMIT: {
      from: 0,
      to: 1
    }
  })

Error

Argument of type '["license-index-json", string, { LIMIT: { from: number; to: number; }; }]' is not assignable to parameter of type '[index: string, query: string, options?: SearchOptions] | [options: CommandOptions, index: string, query: string, options?: SearchOptions]'. Type '["license-index-json", string, { LIMIT: { from: number; to: number; }; }]' is not assignable to type '[options: CommandOptions, index: string, query: string, options?: SearchOptions]'. Type at position 0 in source is not compatible with type at position 0 in target. Type 'string' is not assignable to type 'CommandOptions'. Type 'string' is not assignable to type '{ readonly [symbol]: true; }'.ts(2345)enter image description here


Solution

https://github.com/redis/node-redis/blob/master/packages/search/lib/commands/SEARCH.ts

use from and size, not from and to

client.ft.SEARCH('idx', 'query', {
  LIMIT: {
    from: 0,
    size: 1
  }
});


Answered By - Leibale Eidelman
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing