In my scenario, there is table with column "column1" of string type and column1 can store have int, float ..(any)type of values in string format. I'm creating index with Solr on thable. Can Solr allow indexing on a single field (column1) with multiple data types like string,int..etc ?
1 Answers
No, it can't. Solr needs a field to be a defined type (either through a defined field or through a dynamic field), since querying and sorting is defined differently for different fields. If you're used to processing all the values as a string today, you might be best suited to go with a StrField in the future as well.
Another option is to decide what type of column the field is when indexing, and add the value to different fields based on the type (since it's a string field in the database, you'll have to come up with a heuristic that matches your expected types for the different values in the field). For example by having column1_int, column1_string, column1_float, and then indexing to the field of the correct type. When querying you'll query all the relevant fields, either based on the input data type or by massaging the data appropriately.