Пример #1
0
        public bool PostAddSchemaField(JObject value)
        {
            try
            {
                Schema schema     = new Schema();
                var    schemaName = value["Name"]?.Value <string>();

                if (schemaName.Substring(0, 3) == "LU_")
                {
                    schema.Name         = schemaName;
                    schema.Type         = value["Type"]?.Value <string>();
                    schema.Stored       = value["Stored"]?.Value <string>();
                    schema.Indexed      = value["Indexed"]?.Value <string>();
                    schema.DefaultValue = value["DefaultValue"]?.Value <string>();
                    schema.AddFieldInLucene();
                    schema.SaveInDB();
                }
                else if (schemaName.Substring(0, 3) == "DB_")
                {
                    schema.Name    = schemaName;
                    schema.Type    = value["Type"]?.Value <string>();
                    schema.Stored  = "Yes";
                    schema.Indexed = "No";
                    schema.SaveInDB();
                }
                else
                {
                    schema.Name         = schemaName;
                    schema.Type         = value["Type"]?.Value <string>();
                    schema.Stored       = value["Stored"]?.Value <string>();
                    schema.Indexed      = value["Indexed"]?.Value <string>();
                    schema.DefaultValue = value["DefaultValue"]?.Value <string>();
                    schema.AddFieldInLucene();
                    schema.SaveInDB();
                }
                return(true);
            }
            catch (Exception ex)
            {
                Utilities.SolrException.WriteError(ex);
            }
            return(false);
        }