Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import io.lettuce.core.search.AggregationReply;
import io.lettuce.core.search.AggregationReply.Cursor;
import io.lettuce.core.search.HybridReply;

import io.lettuce.core.search.IndexInfo;
import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.Suggestion;
Expand Down Expand Up @@ -1638,6 +1638,11 @@ public RedisFuture<List<V>> ftList() {
return dispatch(searchCommandBuilder.ftList());
}

@Override
public RedisFuture<IndexInfo<V>> ftInfo(String index) {
return dispatch(searchCommandBuilder.ftInfo(index));
}

@Override
public RedisFuture<Map<V, List<V>>> ftSyndump(String index) {
return dispatch(searchCommandBuilder.ftSyndump(index));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import io.lettuce.core.search.AggregationReply.Cursor;

import io.lettuce.core.search.HybridReply;
import io.lettuce.core.search.IndexInfo;
import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.Suggestion;
Expand Down Expand Up @@ -1699,6 +1700,11 @@ public Flux<V> ftList() {
return createDissolvingFlux(() -> searchCommandBuilder.ftList());
}

@Override
public Mono<IndexInfo<V>> ftInfo(String index) {
return createMono(() -> searchCommandBuilder.ftInfo(index));
}

@Override
public Mono<Map<V, List<V>>> ftSyndump(String index) {
return createMono(() -> searchCommandBuilder.ftSyndump(index));
Expand Down
28 changes: 16 additions & 12 deletions src/main/java/io/lettuce/core/RediSearchCommandBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.CommandKeyword;
import io.lettuce.core.search.AggregateReplyParser;
import io.lettuce.core.search.AggregationReply;
import io.lettuce.core.search.HybridReply;
import io.lettuce.core.search.HybridReplyParser;

import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SearchReplyParser;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.SpellCheckResultParser;
import io.lettuce.core.search.Suggestion;
import io.lettuce.core.search.SuggestionParser;
import io.lettuce.core.search.SynonymMapParser;
import io.lettuce.core.search.*;

import io.lettuce.core.search.arguments.AggregateArgs;
import io.lettuce.core.search.arguments.CreateArgs;
import io.lettuce.core.search.arguments.ExplainArgs;
Expand Down Expand Up @@ -411,6 +401,20 @@ public Command<K, V, String> ftExplain(String index, V query, ExplainArgs<K, V>
return createCommand(FT_EXPLAIN, new StatusOutput<>(codec), commandArgs);
}

/**
* Return information and statistics about an index.
*
* @param index the index name
* @return an IndexInfo object containing index information and statistics
*/
public Command<K, V, IndexInfo<V>> ftInfo(String index) {
LettuceAssert.notNull(index, "Index must not be null");

CommandArgs<K, V> commandArgs = new CommandArgs<>(codec).add(index);

return createCommand(FT_INFO, new EncodedComplexOutput<>(codec, new IndexInfoParser<>(codec)), commandArgs);
}

/**
* Return a list of all existing indexes.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.lettuce.core.annotations.Experimental;
import io.lettuce.core.search.AggregationReply;
import io.lettuce.core.search.HybridReply;
import io.lettuce.core.search.IndexInfo;
import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.Suggestion;
Expand Down Expand Up @@ -628,6 +629,56 @@ public interface RediSearchAsyncCommands<K, V> {
@Experimental
RedisFuture<List<V>> ftList();

/**
* Return information and statistics about a search index.
*
* <p>
* This command returns detailed information and statistics about a specified search index, including configuration, schema
* definition, memory usage, indexing progress, and performance metrics.
* </p>
*
* <p>
* The returned map contains various categories of information:
* </p>
* <ul>
* <li><strong>General:</strong> index_name, index_options, index_definition, attributes, num_docs, max_doc_id, num_terms,
* num_records</li>
* <li><strong>Size statistics:</strong> inverted_sz_mb, vector_index_sz_mb, doc_table_size_mb, sortable_values_size_mb,
* key_table_size_mb, etc.</li>
* <li><strong>Indexing statistics:</strong> hash_indexing_failures, total_indexing_time, indexing, percent_indexed,
* number_of_uses</li>
* <li><strong>Garbage collection:</strong> bytes_collected, total_ms_run, total_cycles, average_cycle_time_ms,
* last_run_time_ms</li>
* <li><strong>Cursor statistics:</strong> global_idle, global_total, index_capacity, index_total</li>
* <li><strong>Dialect statistics:</strong> Usage counts for each query dialect (1-4)</li>
* <li><strong>Error statistics:</strong> Indexing failures and errors per field</li>
* </ul>
*
* <p>
* Key use cases:
* </p>
* <ul>
* <li><strong>Monitoring:</strong> Track index health, memory usage, and performance</li>
* <li><strong>Debugging:</strong> Identify indexing failures and errors</li>
* <li><strong>Capacity planning:</strong> Analyze memory consumption and growth trends</li>
* <li><strong>Performance tuning:</strong> Review indexing time and garbage collection metrics</li>
* </ul>
*
* <p>
* <strong>Time complexity:</strong> O(1)
* </p>
*
* @param index the index name
* @return an IndexInfo object containing index information and statistics
* @since 6.8
* @see <a href="https://redis.io/docs/latest/commands/ft.info/">FT.INFO</a>
* @see #ftCreate(String, CreateArgs, List)
* @see #ftList()
* @see #ftDropindex(String)
*/
@Experimental
RedisFuture<IndexInfo<V>> ftInfo(String index);

/**
* Dump synonym group contents.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.lettuce.core.annotations.Experimental;
import io.lettuce.core.search.AggregationReply;
import io.lettuce.core.search.HybridReply;
import io.lettuce.core.search.IndexInfo;
import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.Suggestion;
Expand Down Expand Up @@ -630,6 +631,56 @@ public interface RediSearchReactiveCommands<K, V> {
@Experimental
Flux<V> ftList();

/**
* Return information and statistics about a search index.
*
* <p>
* This command returns detailed information and statistics about a specified search index, including configuration, schema
* definition, memory usage, indexing progress, and performance metrics.
* </p>
*
* <p>
* The returned map contains various categories of information:
* </p>
* <ul>
* <li><strong>General:</strong> index_name, index_options, index_definition, attributes, num_docs, max_doc_id, num_terms,
* num_records</li>
* <li><strong>Size statistics:</strong> inverted_sz_mb, vector_index_sz_mb, doc_table_size_mb, sortable_values_size_mb,
* key_table_size_mb, etc.</li>
* <li><strong>Indexing statistics:</strong> hash_indexing_failures, total_indexing_time, indexing, percent_indexed,
* number_of_uses</li>
* <li><strong>Garbage collection:</strong> bytes_collected, total_ms_run, total_cycles, average_cycle_time_ms,
* last_run_time_ms</li>
* <li><strong>Cursor statistics:</strong> global_idle, global_total, index_capacity, index_total</li>
* <li><strong>Dialect statistics:</strong> Usage counts for each query dialect (1-4)</li>
* <li><strong>Error statistics:</strong> Indexing failures and errors per field</li>
* </ul>
*
* <p>
* Key use cases:
* </p>
* <ul>
* <li><strong>Monitoring:</strong> Track index health, memory usage, and performance</li>
* <li><strong>Debugging:</strong> Identify indexing failures and errors</li>
* <li><strong>Capacity planning:</strong> Analyze memory consumption and growth trends</li>
* <li><strong>Performance tuning:</strong> Review indexing time and garbage collection metrics</li>
* </ul>
*
* <p>
* <strong>Time complexity:</strong> O(1)
* </p>
*
* @param index the index name
* @return an IndexInfo object containing index information and statistics
* @since 6.8
* @see <a href="https://redis.io/docs/latest/commands/ft.info/">FT.INFO</a>
* @see #ftCreate(String, CreateArgs, List)
* @see #ftList()
* @see #ftDropindex(String)
*/
@Experimental
Mono<IndexInfo<V>> ftInfo(String index);

/**
* Dump synonym group contents.
*
Expand Down
51 changes: 51 additions & 0 deletions src/main/java/io/lettuce/core/api/sync/RediSearchCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.lettuce.core.annotations.Experimental;
import io.lettuce.core.search.AggregationReply;
import io.lettuce.core.search.HybridReply;
import io.lettuce.core.search.IndexInfo;
import io.lettuce.core.search.SearchReply;
import io.lettuce.core.search.SpellCheckResult;
import io.lettuce.core.search.Suggestion;
Expand Down Expand Up @@ -628,6 +629,56 @@ public interface RediSearchCommands<K, V> {
@Experimental
List<V> ftList();

/**
* Return information and statistics about a search index.
*
* <p>
* This command returns detailed information and statistics about a specified search index, including configuration, schema
* definition, memory usage, indexing progress, and performance metrics.
* </p>
*
* <p>
* The returned map contains various categories of information:
* </p>
* <ul>
* <li><strong>General:</strong> index_name, index_options, index_definition, attributes, num_docs, max_doc_id, num_terms,
* num_records</li>
* <li><strong>Size statistics:</strong> inverted_sz_mb, vector_index_sz_mb, doc_table_size_mb, sortable_values_size_mb,
* key_table_size_mb, etc.</li>
* <li><strong>Indexing statistics:</strong> hash_indexing_failures, total_indexing_time, indexing, percent_indexed,
* number_of_uses</li>
* <li><strong>Garbage collection:</strong> bytes_collected, total_ms_run, total_cycles, average_cycle_time_ms,
* last_run_time_ms</li>
* <li><strong>Cursor statistics:</strong> global_idle, global_total, index_capacity, index_total</li>
* <li><strong>Dialect statistics:</strong> Usage counts for each query dialect (1-4)</li>
* <li><strong>Error statistics:</strong> Indexing failures and errors per field</li>
* </ul>
*
* <p>
* Key use cases:
* </p>
* <ul>
* <li><strong>Monitoring:</strong> Track index health, memory usage, and performance</li>
* <li><strong>Debugging:</strong> Identify indexing failures and errors</li>
* <li><strong>Capacity planning:</strong> Analyze memory consumption and growth trends</li>
* <li><strong>Performance tuning:</strong> Review indexing time and garbage collection metrics</li>
* </ul>
*
* <p>
* <strong>Time complexity:</strong> O(1)
* </p>
*
* @param index the index name
* @return an IndexInfo object containing index information and statistics
* @since 6.8
* @see <a href="https://redis.io/docs/latest/commands/ft.info/">FT.INFO</a>
* @see #ftCreate(String, CreateArgs, List)
* @see #ftList()
* @see #ftDropindex(String)
*/
@Experimental
IndexInfo<V> ftInfo(String index);

/**
* Dump synonym group contents.
*
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/io/lettuce/core/protocol/CommandType.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ public enum CommandType implements ProtocolKeyword {
FT_AGGREGATE("FT.AGGREGATE"), FT_ALIASADD("FT.ALIASADD"), FT_ALIASDEL("FT.ALIASDEL"), FT_ALIASUPDATE(
"FT.ALIASUPDATE"), FT_ALTER("FT.ALTER"), FT_CREATE("FT.CREATE"), FT_CURSOR("FT.CURSOR"), FT_DICTADD(
"FT.DICTADD"), FT_DICTDEL("FT.DICTDEL"), FT_DICTDUMP("FT.DICTDUMP"), FT_DROPINDEX(
"FT.DROPINDEX"), FT_EXPLAIN("FT.EXPLAIN"), FT_HYBRID("FT.HYBRID"), FT_LIST("FT._LIST"), FT_SEARCH(
"FT.SEARCH"), FT_SPELLCHECK("FT.SPELLCHECK"), FT_SUGADD("FT.SUGADD"), FT_SUGDEL(
"FT.SUGDEL"), FT_SUGGET("FT.SUGGET"), FT_SUGLEN("FT.SUGLEN"), FT_SYNDUMP(
"FT.SYNDUMP"), FT_SYNUPDATE("FT.SYNUPDATE"), FT_TAGVALS("FT.TAGVALS"),
"FT.DROPINDEX"), FT_EXPLAIN("FT.EXPLAIN"), FT_HYBRID("FT.HYBRID"), FT_INFO("FT.INFO"), FT_LIST(
"FT._LIST"), FT_SEARCH("FT.SEARCH"), FT_SPELLCHECK("FT.SPELLCHECK"), FT_SUGADD(
"FT.SUGADD"), FT_SUGDEL("FT.SUGDEL"), FT_SUGGET("FT.SUGGET"), FT_SUGLEN(
"FT.SUGLEN"), FT_SYNDUMP("FT.SYNDUMP"), FT_SYNUPDATE(
"FT.SYNUPDATE"), FT_TAGVALS("FT.TAGVALS"),

// Others

Expand Down
Loading
Loading