So I have a Windows Forms project up and running. It uses the Lucene.Net library and I made a Lucene index with it. The program takes user requests, runs them through some algorithms and displays the resultsets in a DataGridView.
Afterwards I installed XAMPP, using the Tomcat service for setting up Solr 3.6.1. I configured the schema.xml as following (thanks to Can a raw Lucene index be loaded by Solr?):
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
[...]
<field name="LuminaireId" type="string" indexed="true" stored="true"/>
<field name="LampCount" type="tdouble" multiValued="true" indexed="true" stored="true" required="false"/>
[...]
I searched for some examples for how to setup all the stuff and came up with a Product-Class for mapping the values (there are some more values, but for getting the picture this will be sufficient, I think) like this:
public class SolrProduct
{
[SolrUniqueKey("LuminaireId")]
public string LuminaireId { get; set; }
[SolrField("LampCount")]
public ICollection<double> LampCount { get; set; }
}
A simple test-query (using this method)
internal override List<KeyValuePair<Int64, Double>> CalculateRanking(List<T> checkedAttributes)
{
Startup.Init<SolrProduct>("http://localhost:8983/solr/");
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<SolrProduct>>();
var results = solr.Query("LampCount:1");
// as is: no mapping for result-return for now, returning "null" instead
return(null);
}
produces an ArgumentException, telling me that the object of type "System.Collections.ArrayList" cannot be converted to type "System.String". Even after searching for that problem on the internet and debugging the program, I still don't understand the Exception. "LampCount" is an multiValued-Field (former NumericField in the Lucene index), with the schema.xml and mapping in the Product.cs it should work.
It works when using the webinterface on localhost:8983/solr/admin/, I can shoot a query as "LampCount:1" and it returns a bunch of correctly found documents. This might be another problem, but with all "setup as is", the resultset XML of the Solr webinterface shows (in every found document):
<arr name="LampCount">
<str>ERROR:SCHEMA-INDEX-MISMATCH,stringValue=1</str>
</arr>
I indexed the LampCount-field for Lucene index documents with
var valueField = new NumericField(internalname, Field.Store.YES, true);
valueField.SetDoubleValue(value);
doc.Add(valueField);
Can this be the problem, for I cannot see the big picture at the moment and feel totally lost. Much appreciated if you can untie my brainknot. ;-)
Thanks in advance!