Size() публичный Метод

public Size ( ) : int
Результат int
Пример #1
0
        private void ReconstructFields(Hashtable doc)
        {
            fields = new ArrayList(doc.Count + 5);
            fieldsReconstructed = new ArrayList(doc.Count + 5);
            int i = 0;

            foreach (string key in doc.Keys)
            {
                Object t = doc[key];

                // create/reconstruct fields
                if (typeof(Field).IsInstanceOfType(t))
                {
                    fields.Add(t);
                    fieldsReconstructed.Add(false);
                }
                else
                {
                    fieldsReconstructed.Add(true);

                    GrowableStringArray terms = (GrowableStringArray)doc[key];
                    StringBuilder       sb    = new StringBuilder();
                    if (terms != null)
                    {
                        String sNull = "null";
                        int    k = 0, m = 0;
                        for (int j = 0; j < terms.Size(); j++)
                        {
                            if (terms.Get(j) == null)
                            {
                                k++;
                            }
                            else
                            {
                                if (sb.Length > 0)
                                {
                                    sb.Append(' ');
                                }
                                if (k > 0)
                                {
                                    sb.Append(sNull + "_" + k + " ");
                                    k = 0;
                                    m++;
                                }
                                sb.Append(terms.Get(j));
                                m++;
                                if (m % 10 == 0)
                                {
                                    sb.Append('\n');
                                }
                            }
                        }
                    }
                    Field newField = new Field(key, sb.ToString(), Field.Store.NO, Field.Index.NOT_ANALYZED, Field.TermVector.NO);
                    newField.SetBoost(document.GetBoost());
                    fields.Add(newField);
                }
                i++;
            }
        }