question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

non-collection properties (string, decimal, etc) are created on solr as collection typeswith Attribute mapping

See original GitHub issue

Hi, i’m having some problems with Attribute Mapping.

My scenario is:

  • Solr 5.2.1 hosted on ubuntu machine
  • Project ASP.NET MVC

Following the documentation example, i created the model and insert test data.

public Product()
{
    Id = Guid.NewGuid().ToString();
    Manufacturer = "Sample Manufacturer";
    Categories = new List<string> { "Category 1", "Category 2", "Category 3" };
    Price = 100;
    InStock = true;
    Timestamp = DateTime.Now;
    Weight = null;
}

and the document are created as:

"docs": [{
    "id": "05e77caa-5d54-4f8f-b3c5-5eac14579f4e",
    "manu_exact": [
        "Sample Manufacturer"
    ],
    "cat": [
        "Category 1",
        "Category 2",
        "Category 3"
    ],
    "price": [
        100
    ],
    "inStock": [
        true
    ],
    "timestamp": [
        "2016-01-07T23:54:53.99Z"
    ],
    "_version_": 1522761031815790600
}]

That causing problems when retrieve the data.

Object of type 'System.Collections.ArrayList' cannot be converted to type 'System.String'.

Can anyone help?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mauschcommented, Jan 11, 2016
0reactions
ledangtuanbkcommented, Apr 11, 2017

I meet the same problem, but I can’t resolve it.

I use Win 10.

My Command to create solr like that :

solr create -c test_query -n basic_configs

public class TestEntity
    {
        // Id duy nhat
        [SolrUniqueKey("id")]
        public string Id { get; set; }

        // Ten benh nhan
        // patient name
        [XmlElement(ElementName = "cdyt_time")]
        [DataMember(Name = "cdyt_time", IsRequired = true)]
        [SolrField("cdyt_time")]
        public long Time { get; set; }

        // patient name
        [XmlElement(ElementName = "cdyt_patient_name")]
        [DataMember(Name = "cdyt_patient_name", IsRequired = true)]
        [SolrField("cdyt_patient_name")]
        public string PatientName { get; set; }


        public TestEntity(string id, long time, string patientName)
        {                      
            this.Id = id;
            this.Time = time;
            this.PatientName = patientName;
        }

        public TestEntity()
        {
            var mgr = new MappingManager();
            var property = typeof(TestEntity).GetProperty("Id");
            mgr.Add(property, "id");
            mgr.SetUniqueKey(property);
            
        }
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Collection Management Commands
Defines the name of the configuration (which must already be stored in ZooKeeper) to use for this collection. If not provided, Solr will...
Read more >
Field Types Included with Solr
The following table lists the field types that are available in Solr. The org.apache.solr.schema package includes all the classes listed in this table....
Read more >
Collection Management Commands
A collection is a single logical index that uses a single Solr configuration file ... See the CREATE action section above for details...
Read more >
Collections API | Apache Solr Reference Guide 6.6
The Collections API is used to enable you to create, remove, or reload collections, but in the context of SolrCloud you can also...
Read more >
Collections API | Apache Solr Reference Guide 8.1
In the context of SolrCloud you can use it to create collections with a specific number of shards and replicas, move replicas or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found