Index the value of an Enum, not the string

后端 未结 2 1365
春和景丽
春和景丽 2021-01-24 05:45

Is it possible to index the value of an Enum instead of its string representation using Solrnet?

Say I have to following enum:

[Serializable]
[Flags] 
pu         


        
2条回答
  •  天命终不由人
    2021-01-24 06:08

    You can do this by implementing ISolrFieldSerializer. If the type IsEnum, serialize by casting to int. Otherwise delegate to DefaultFieldSerializer. Use the other field serializers for reference.

    Hooking up your field serializer depends on the chosen IoC container, check the container's documentation.

提交回复
热议问题