Skip to content

Feature suggestion: FT.SEARCH - optional "which fields to return" modifier #42

Closed

Description

@mgravell

The INFIELDS modifier tells it which fields to look at, but it returns either all or nothing (via NOCONTENT), but - this doesn't seem very granular compared to similar tools that allow restriction of returned fields (you might want a few key pieces of metadata, but not the heavy text data, for example).

Suggest: something like INFIELDS, but for the values to return in addition to the document id (defaults to all if not specified). There's a question as to what to do if this proposed modifier was specified in addition to NOCONTENT... I guess either an error or NOCONTENT wins?

This is not a blocker for me, though - merely a suggestion.

Activity

  1. dvirsky commented on Apr 30, 2017

    @dvirsky
    Contributor

    Yeah, it's been in the TODO for ages, and it should really be trivial to implement :) Also generating snippets on the fly would be nice.

  2. dvirsky commented on Apr 30, 2017

    @dvirsky
    Contributor

    (hint: PRs would be welcome ;) )

  3. dvirsky commented on Apr 30, 2017

    @dvirsky
    Contributor

    BTW - not really a workaround, but you can of course retrieve the IDs and then do HMGET on them, the documents are stored simply as plain redis hashes.

  4. dvirsky commented on Jun 30, 2017

    @dvirsky
    Contributor

    @mnunberg you can take this one, it's pretty straightforward.

    1. The API should look like RETURN {num} {field} {field}.... Having the number allows us to have field names that are reserved words, similar to INKEYS, INFIELDS, etc.

    2. This should be reflected in the RSSearchRequest struct.

    3. Field names must be copied to the request, because the query will be execute on a separate thread after the original caller's auto memory has finished freeing them

    4. RETURN 0 is valid and equivalent to NOCONTENT. I wouldn't enforce a limit on the number of fields, but make sure that it's not overflowing argc of course.

    5. Non indexed fields that are not in the schema are allowed - the schema only refers to indexing, it is perfectly okay to add documents with fields outside the schema. Just use the fields for the RM_HashGet call.

    6. fields should be case sensitive in this context. There are places they aren't but I want to move to a fully case sensitive mode of operation, we can start here :)

    7. When you're done, don't forget:
      a. a python test.
      b. document this in Commands.md
      b. please add this feature to the python and java clients.

    Thanks!

  5. added 6 commits that reference this issue on Jul 5, 2017
  6. dvirsky commented on Jul 9, 2017

    @dvirsky
    Contributor

    Fixed in current master, will be included in next release.

  7. added a commit that references this issue on Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions