/// <inheritdoc cref="MorphologyProvider.FindWord"/>
        public override MorphologyEntry[] FindWord
        (
            string word
        )
        {
            ManagedClient64 client   = Client.ThrowIfNull("Client");
            string          database = Database.ThrowIfNull("Database");


            client.PushDatabase(database);
            try
            {
                IrbisRecord[] records = client.SearchRead
                                        (
                    "\"K={0}\"",
                    word
                                        );
                MorphologyEntry[] result = records
                                           .Select(r => MorphologyEntry.Parse(r))
                                           .ToArray();

                return(result);
            }
            finally
            {
                client.PopDatabase();
            }
        }
Exemplo n.º 2
0
        public static List <ReaderInfo> LoadReaders
        (
            [NotNull] ManagedClient64 client,
            [NotNull] List <ReaderInfo> readers,
            [NotNull] string dbName
        )
        {
            if (ReferenceEquals(client, null))
            {
                throw new ArgumentNullException("client");
            }
            if (ReferenceEquals(readers, null))
            {
                throw new ArgumentNullException("readers");
            }
            if (string.IsNullOrEmpty(dbName))
            {
                throw new ArgumentNullException("dbName");
            }

            try
            {
                client.PushDatabase(dbName);
                readers.Capacity += client.GetMaxMfn();

                BatchRecordReader batch = new BatchRecordReader
                                          (
                    client,
                    1500
                                          );

                Parallel.ForEach
                (
                    batch,
                    record =>
                {
                    if (!record.Deleted)
                    {
                        ReaderInfo reader
                            = ReaderInfo.Parse(record);
                        lock (readers)
                        {
                            readers.Add(reader);
                        }
                    }
                }
                );
            }
            finally
            {
                client.PopDatabase();
            }

            return(readers);
        }