Developer forum

Forum » Development » Problem with missing fields in index

Problem with missing fields in index

Anders Ebdrup
Reply

Hi,

 

I have a problem with my index and it could be related to this part

private static Lucene.Net.Documents.Document EntryToDocument(IndexEntry e, bool createSummaryField)
        {
            string value = string.Empty;
            IndexEntryFieldInfo info = null;
            Lucene.Net.Documents.Document ret = new Lucene.Net.Documents.Document();
            string summaryFieldName = IndexEntry.GetSystemFieldName(IndexEntrySystemField.Summary);
            System.Collections.Generic.Dictionary<string, string> allFields = new System.Collections.Generic.Dictionary<string, string>(e.Fields);

            if (createSummaryField && !allFields.ContainsKey(summaryFieldName))
                allFields.Add(summaryFieldName, e.Summary);

            foreach (string name in allFields.Keys)
            {
                if (!string.IsNullOrEmpty(allFields[name]))
                {
                    value = allFields[name];
                    info = e.InitializeField(name, value);

                    if (info != null)
                    {
                        ret.Add(new Lucene.Net.Documents.Field(info.Name, info.Value,
                            (info.Store ? Lucene.Net.Documents.Field.Store.YES : Lucene.Net.Documents.Field.Store.NO),
                            (info.Tokenize ? Lucene.Net.Documents.Field.Index.ANALYZED : Lucene.Net.Documents.Field.Index.NOT_ANALYZED),
                            (info.UseTermVector ? Lucene.Net.Documents.Field.TermVector.YES : Lucene.Net.Documents.Field.TermVector.NO)));
                    }
                }
            }

            return ret;
        }

Where you only put values in the index if it has a value:

if (!string.IsNullOrEmpty(allFields[name]))

And it gives an index with different columns which doesn't seem to be working.

 

Any thoughts on this?

 

Best regards Anders

 


Replies

 
Vladimir
Reply

Hi Anders,

please describe what doesn't work.
This is usual that some fields are empty and I don't feel something wrong with that.

 

Bes regards, Vladimir

 

 

 

 

 
Anders Ebdrup
Reply

Hi Vladimir,

I have had a lot of issues with the index, but it does not seem to be caused by this, so sorry for the initial post.

Best regards, Anders

 

You must be logged in to post in the forum