storing "document type" in index along with documents

Jan 25, 2012 at 4:09 PM

Can we store type of the document along with document in the index?
For ex: let us define a enum called DocType
 
public enum DocType
{
Class=0,
Method=1,
...
}

While storing in index we add the highlighted ones for the document. This doc type will enable a way to package the Document Hits into appropriate elements.

  1. Class:
    1. Id (Guid)
    2. Name (string)
    3. ? Namespace (string)
    4. ? ExtendedClasses (string - so that - as an option - the user can search across the inheritance tree - i.e. "Animal" search returns also classes "Dog", "Cat" etc.)
    5. ? ImplementedInterfaces (string - like the previous one)
    6. ? AccessLevel (enum)
    7. FileName (string)
    8. DefinitionLineNumber (int)
    9. FullFilePath (string)
    10. DocType (int) with value 0
  2. Method
    1. Id (Guid)
    2. Name (string)
    3. Arguments (string)
    4. ReturnType (string)
    5. Body (string)
    6. ? AccessLevel (enum)
    7. DefinitionLineNumber (int)
    8. ClassId (Guid - reference so that we can extract any class-level info, like file path)
    9. DocType (int) with value 1
Coordinator
Jan 25, 2012 at 5:25 PM

Sure - I wrote about filtering search results by program element type in "Lucene.Net usage" discussion - I like your idea - I'm going to add such enum along with the field in the Indexer project - nice work!