-define(INFODIGGER, infodigger).
-define(INFODIGGER_PORT, infodigger_driver).
-define(INFODIGGER_COMMAND, {TaskID, Command, Params, Owner}).
-define(INFODIGGER_REQUEST(T, C, P, O), {T, C, P, O}).
-define(INFODIGGER_REQUEST_LOAD, {?INFODIGGER, load_driver}).
-define(INFODIGGER_REQUEST_UNLOAD, {?INFODIGGER, unload_driver}).
-define(INFODIGGER_REQUEST_RELOAD, {?INFODIGGER, reload_driver}).
-define(INFODIGGER_REQUEST_TESTS, {?INFODIGGER, spawn_test_server}).
-define(INFODIGGER_REQUEST_TIMEOUT, 2000).
-define(INFODIGGER_SERVICE, infodigger_service).
-define(INFODIGGER_SERVICE_RESULT(TaskID, Type, Data), {?INFODIGGER, TaskID, Type, Data}).
-define(INFODIGGER_SERVICE_COMMAND, {TaskID, Command, Params, Owner}).
-define(INFODIGGER_MAX_RECORDS, 100).
-define(INFODIGGER_TESTER, infodigger_tester).
-define(INFODIGGER_COMMAND_LOAD, 100).
-define(INFODIGGER_COMMAND_COUNT, 103).
-define(INFODIGGER_COMMAND_LIST, 104).
-define(INFODIGGER_COMMAND_REMOVE_EXTFILE, 106). % Removes list of files with fully qualified item names from an external text file.
-define(INFODIGGER_COMMAND_INFO, 107).
-define(INFODIGGER_COMMAND_VERIFY, 108).
-define(INFODIGGER_COMMAND_REMOVE, 109). % Removes list of items from Index.
-define(INFODIGGER_COMMAND_CREATE, 200).
-define(INFODIGGER_COMMAND_SEARCH, 300).
-define(INFODIGGER_COMMAND_INDEX, 400).
%-define(INFODIGGER_COMMAND_INDEX_CONTAINER, 402). % Removed since INFODIGGER 2019.
-define(INFODIGGER_COMMAND_INDEX_COMPACT, 403).
-define(INFODIGGER_COMMAND_INDEX_OBJECTS, 404).
-define(INFODIGGER_COMMAND_CYRILLIC_TO_LATIN, 500).
-define(INFODIGGER_COMMAND_LATIN_TO_CYRILLIC, 501).
-define(INFODIGGER_COMMAND_LATIN_TO_CYRILLIC_VARS, 502).
-define(INFODIGGER_COMMAND_LATIN_TO_CYRILLIC_FIELDS, 503).
-define(INFODIGGER_COMMAND_LATIN_TO_CYRILLIC_PARSER, 504).
-define(INFODIGGER_COMMAND_GET_BUILD, 999).
-define(INFODIGGER_FILTER_DEFAULT, ?INFODIGGER_FILTER_AUTOTEXT).
-define(INFODIGGER_FILTER_OFFICE, 200).
-define(INFODIGGER_FILTER_ANSI, 202).
-define(INFODIGGER_FILTER_ASCII, 203).
-define(INFODIGGER_FILTER_BIN, 204).
-define(INFODIGGER_FILTER_BINFLTR, 207).
-define(INFODIGGER_FILTER_MSWORDDOS, 209).
-define(INFODIGGER_FILTER_RTF, 212).
-define(INFODIGGER_FILTER_MSWINWRITE, 215).
-define(INFODIGGER_FILTER_MSWORD2, 216).
-define(INFODIGGER_FILTER_MSWORD6, 217).
-define(INFODIGGER_FILTER_ZIP, 223).
-define(INFODIGGER_FILTER_PROPRTS, 224).
-define(INFODIGGER_FILTER_MSEXEL, 225).
-define(INFODIGGER_FILTER_HTML, 226).
-define(INFODIGGER_FILTER_PDF, 227).
-define(INFODIGGER_FILTER_MSWORD97, 228).
-define(INFODIGGER_FILTER_MSEXEL97, 229).
-define(INFODIGGER_FILTER_POWERPOINT, 230).
-define(INFODIGGER_FILTER_ACCESS, 232).
-define(INFODIGGER_FILTER_SEGTEXT, 233).
-define(INFODIGGER_FILTER_XML, 234).
-define(INFODIGGER_FILTER_UNICODE, 236).
-define(INFODIGGER_FILTER_EUDORA, 237).
-define(INFODIGGER_FILTER_UTF8, 238).
-define(INFODIGGER_FILTER_AUTOTEXT, 242).
-define(INFODIGGER_FILTER_BINUNICODE, 244).
-define(INFODIGGER_FILTER_ZIPZLIB, 245).
-define(INFODIGGER_FILTER_BINSTREAM, 249).
-define(INFODIGGER_REGISTER_IDX(Database, Params), {register, Index, Params}).
-define(INFODIGGER_REGISTER, {register, Index, Params}).
-define(INFODIGGER_UNREGISTER_IDX(Database), {unregister, Index}).
-define(INFODIGGER_UNREGISTER, {unregister, Index}).
-define(INFODIGGER_PROCESSOR_REQUEST(Task), {?INFODIGGER, process, Task}).
-define(INFODIGGER_PROCESSOR_SHUTDOWN, ?INFODIGGER_PROCESSOR_REQUEST(shutdown)).
-define(INFODIGGER_PROCESSOR_TIMEOUT, 8000).
-define(INFODIGGER_SEARCH_OPTIONS(Timeout, Fuzziness, Limit), [
{search_timeout, Timeout},
{search_fuzziness, Fuzziness},
{search_limit, Limit}
]).
-define(INFODIGGER_INDEX_OPTIONS(IncludeFilter, ExcludeFilter, FieldsFilter), [
{index_include, IncludeFilter},
{index_exclude, ExcludeFilter},
{index_fields, FieldsFilter}
]).
-define(INFODIGGER_INDEX_FILE(Name, Path, Fields), #{
name => Name,
path => Path,
fields => Fields,
filter => ?INFODIGGER_FILTER_DEFAULT
}).
-define(INFODIGGER_INDEX_BLOB(Name, Data, Timestamp, Fields), #{
name => Name,
blob => Data,
fields => Fields,
timestamp => age_calendar:datetime_to_iso8601(Timestamp),
filter => ?INFODIGGER_FILTER_DEFAULT
}).
-define(INFODIGGER_TASKS_DB, infodigger_tasks).
-define(INFODIGGER_TASK_UNKNOWN, unknown_task).
-define(INFODIGGER_INDEXES, infodigger_indexes).
-define(INFODIGGER_INDEX_UNKNOWN, unknown_index).
-define(INFODIGGER_INVALID_STATE, invalid_state).
% @type infodigger_field() = {atom(), any()}
% @type infodigger_system_fileds() = list(infodigger_field())
% @type infodigger_custom_fields() = list(infodigger_field())
% @type infodigger_container() = {container, infodigger_custom_fields()}
% @type infodigger_object_file() = {file, Name, Path}
% @type infodigger_object_blob() = {blob, Name, Data, TimeStamp}
% @type infodigger_object_type() = infodigger_object_file() | infodigger_object_blob()
% @type infodigger_object() = {record, infodigger_object_type(), infodigger_custom_fields()}
% @type infodigger_result() = {infodigger, Type, Data}
% @type infodigger_error() = {error, Type, Data}
% @type infodigger_response_handler() = {Module::atom(), Function::function(TaskID, Response)}
% @type infodigger_response_owner() = pid() | infodigger_response_handler()
-type(infodigger_response_handler() :: {Module::atom(), Function::fun()}).
-type(infodigger_response_owner() :: pid() | infodigger_response_handler()).
% @type infodigger_state() = enabled | disabled | updating
% @type infodigger_index() = {infodigger_index, id, handle, state, location, home, temp, processor}
-record(infodigger_index, {
% Index identifier
id :: atom(),
% Index handle (for future use)
handle = 0 :: integer(),
% Index state (enabled, disabled, updating)
state = enabled :: atom(),
% Index path
location :: list(any()),
% Home path
home :: list(any()),
% Temp path
temp :: list(any()),
% Processor
processor :: pid()
}).
|