当前位置: 首页>>代码示例>>C#>>正文


C# IRecord.GetValues方法代码示例

本文整理汇总了C#中IRecord.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# IRecord.GetValues方法的具体用法?C# IRecord.GetValues怎么用?C# IRecord.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRecord的用法示例。


在下文中一共展示了IRecord.GetValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterByType

        private bool FilterByType(IRecord record)
        {
            if (_types.Count == 0) // there is no filtering
                return true;

            bool found = false;
            return record.GetValues(RDF_TYPE).Any(value => _types.Contains(value));
        }
开发者ID:donners77,项目名称:DukeSharp,代码行数:8,代码来源:RecordHandler.cs

示例2: RecordToString

        public static String RecordToString(IRecord r)
        {
            var sb = new StringBuilder();
            foreach (var p in r.GetProperties())
            {
                var vs = r.GetValues(p);
                if (vs == null || vs.Count == 0)
                    continue;

                sb.Append(p + ": ");
                foreach (var v in vs)
                {
                    sb.Append(String.Format("'{0}', ", v));
                }
            }

            return sb.ToString();
        }
开发者ID:donners77,项目名称:DukeSharp,代码行数:18,代码来源:PrintMatchListener.cs

示例3: Lookup

        public List<IRecord> Lookup(IRecord record)
        {
            // first we build the combined query for all lookup properties
            var query = new BooleanQuery();
            foreach (var lookupProperty in _config.GetLookupProperties())
            {
                var values = record.GetValues(lookupProperty.Name);
                if (values == null)
                    continue;
                foreach (var value in values)
                {
                    ParseTokens(query, lookupProperty.Name, value);
                }
            }

            // then we perform the actual search
            return DoQuery(query);
        }
开发者ID:donners77,项目名称:DukeSharp,代码行数:18,代码来源:QueryResultTracker.cs

示例4: Compare

        public double Compare(IRecord r1, IRecord r2)
        {
            double prob = 0.5;
            foreach (string propname in r1.GetProperties())
            {
                Property prop = _config.GetPropertyByName(propname);
                if (prop.IsIdProperty || prop.IsIgnoreProperty())
                    continue;

                List<string> vs1 = r1.GetValues(propname);
                List<string> vs2 = r2.GetValues(propname);
                if ((vs1.Count == 0) || (vs2.Count == 0))
                    continue; // no values to compare, so skip

                double high = 0.0;
                foreach (string v1 in vs1)
                {
                    if (v1.Equals("")) //TODO: These values shouldn't be here at all.
                        continue;

                    foreach (string v2 in vs2)
                    {
                        if (v2.Equals("")) //TODO: These values shouldn't be here at all.
                            continue;

                        try
                        {
                            double p = prop.Compare(v1, v2);
                            high = Math.Max(high, p);
                        }
                        catch (Exception e)
                        {
                            throw new DukeException(String.Format("Comparison of values {0} and {1} failed. {2}", v1, v2,
                                                                  e.Message));
                        }
                    }
                }

                prob = StandardUtils.ComputeBayes(prob, high);
            }

            return prob;
        }
开发者ID:donners77,项目名称:DukeSharp,代码行数:43,代码来源:Processor.cs

示例5: IsSameAs

 // Internals
 private bool IsSameAs(IRecord r1, IRecord r2)
 {
     foreach (Property idp in _config.GetIdentityProperties())
     {
         List<string> vs2 = r2.GetValues(idp.Name);
         List<string> vs1 = r1.GetValues(idp.Name);
         if (vs1 == null)
             continue;
         foreach (string v1 in vs1)
         {
             if (vs2.Contains(v1)) return true;
         }
     }
     return false;
 }
开发者ID:donners77,项目名称:DukeSharp,代码行数:16,代码来源:Processor.cs

示例6: Index

        public void Index(IRecord record)
        {
            var doc = new Document();

            foreach (string propname in record.GetProperties())
            {
                Property prop = _config.GetPropertyByName(propname);
                if (prop == null)
                {
                    throw new Exception(String.Format("Record has property {0} for which there is no configuration.",
                                                      propname));
                }

                Field.Index ix; //TODO: could cache this. or get it from property
                ix = prop.IsIdProperty ? Field.Index.NOT_ANALYZED : Field.Index.ANALYZED;

                foreach (string v in record.GetValues(propname))
                {
                    if (v.Equals(""))
                        continue; //FIXME: not sure if this is necessary

                    doc.Add(new Field(propname, v, Field.Store.YES, ix));
                }
            }

            try
            {
                _iwriter.AddDocument(doc);
            }
            catch (Exception ex)
            {
                logger.Error("Error adding document to index writer: {0}", ex.Message);
            }
        }
开发者ID:donners77,项目名称:DukeSharp,代码行数:34,代码来源:LuceneDatabase.cs


注:本文中的IRecord.GetValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。