get_index_info

View as MarkdownOpen in Claude

Retrieve information about a search index, including its type, configuration, and chunk/file counts. Use this to inspect an index before migrating it.

Parameters

index_path
strRequired

Path to a .swsearch file. Non-.swsearch paths return {"type": "unknown"} with no additional data.

Returns

dict[str, Any] — A dictionary containing:

  • type (str) — "sqlite" or "unknown"
  • path (str) — the provided path
  • config (dict) — index configuration (SQLite only)
  • total_chunks (int) — chunk count (SQLite only)
  • total_files (int) — file count (SQLite only)

Example

1from signalwire.search import SearchIndexMigrator
2
3migrator = SearchIndexMigrator()
4info = migrator.get_index_info("knowledge.swsearch")
5
6print(f"Type: {info['type']}")
7print(f"Chunks: {info.get('total_chunks', 'N/A')}")
8print(f"Files: {info.get('total_files', 'N/A')}")