Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string. If kwargs["increment"] is true and the terms are already in the server's dictionary, we increment their scores. For more information see `FT.SUGADD <https://redis.io/co
(self, key, *suggestions, **kwargs)
| 1963 | return Document(id=id, **fields) |
| 1964 | |
| 1965 | async def sugadd(self, key, *suggestions, **kwargs): |
| 1966 | """ |
| 1967 | Add suggestion terms to the AutoCompleter engine. Each suggestion has |
| 1968 | a score and string. |
| 1969 | If kwargs["increment"] is true and the terms are already in the |
| 1970 | server's dictionary, we increment their scores. |
| 1971 | |
| 1972 | For more information see `FT.SUGADD <https://redis.io/commands/ft.sugadd>`_. |
| 1973 | """ # noqa |
| 1974 | # If Transaction is not False it will MULTI/EXEC which will error |
| 1975 | pipe = self.pipeline(transaction=False) |
| 1976 | for sug in suggestions: |
| 1977 | args = [SUGADD_COMMAND, key, sug.string, sug.score] |
| 1978 | if kwargs.get("increment"): |
| 1979 | args.append("INCR") |
| 1980 | if sug.payload: |
| 1981 | args.append("PAYLOAD") |
| 1982 | args.append(sug.payload) |
| 1983 | |
| 1984 | pipe.execute_command(*args) |
| 1985 | |
| 1986 | return (await pipe.execute())[-1] |
| 1987 | |
| 1988 | async def sugget( |
| 1989 | self, |
nothing calls this directly
no test coverage detected