I am trying to do the search but I got stumble as there are no example
in the web showing how to run the search on multiple fields.
Here is my schema:
<fields>
<field name="RID" type="string" indexed="true" stored="true"
required="true" />
<field name="Name" type="text" indexed="true" stored="true"
required="false" />
<field name="Address" type="text" indexed="true" stored="true"
required="false" />
<field name="Style" type="text" indexed="true" stored="true"
required="false" />
<field name="DID" type="string" indexed="true" stored="true"
required="true" />
<field name="Title" type="text" indexed="true" stored="true"
required="false" />
<field name="Description" type="text" indexed="true"
stored="true" multiValued="true" required="false" />
<field name="WordSearch" type="text" indexed="true"
stored="true" required="false" />
<field name="textSearch" type="text" indexed="true"
stored="false" required="false" multiValued="true"/>
</fields>
<uniqueKey>DID</uniqueKey>
<defaultSearchField>textSearch</defaultSearchField>
<solrQueryParser defaultOperator="OR" />
<copyField source="Name" dest="textSearch"/>
<copyField source="Style" dest="textSearch"/>
<copyField source="Title" dest="textSearch"/>
<copyField source="Description" dest="textSearch"/>
<copyField source="WordSearch" dest="textSearch"/>
Here is the part of my test app:
public class Review
{
/* attribute decorations tell solrnet how to map
the properties to Solr fields. */
[SolrUniqueKey("RID")]
public string RID { get; set; }
[SolrField("Name")]
public string Name { get; set; }
[SolrField("Address")]
public string Address { get; set; }
[SolrField("Style")]
public string Style { get; set; }
[SolrUniqueKey("DID")]
public string DID { get; set; }
[SolrField("Title")]
public string Title { get; set; }
[SolrField("Description")]
public string Description { get; set; }
[SolrField("WordSearch")]
public string WordSearch { get; set; }
[SolrField("textSearch")]
public string textSearch { get; set; }
}
static void Main(string[] args)
{
/* create a session */
Startup.Init<Review>("
http://localhost:8080/solr");
ISolrOperations<Review> solr =
ServiceLocator.Current.GetInstance<ISolrOperations<Review>>();
/* issue a lucene query */
ICollection<Review> results = solr.Query("Solr");
foreach (Review r in results)
{
Console.WriteLine(r.Name);
}
Console.Read();
}
I am not sure why but I either got nothing in return when it suppose
to have around 59 records or I got this crazy error message
"Object of type 'System.Collections.ArrayList' cannot be converted to
type 'System.String'."
I saw an example here:
http://surinder.computing-studio.com/post/2010/12/13/Multi-Query-Search-Using-LuceneNET.aspx
But in this example on line 80 they use:
Analyzer analyzer = new StandardAnalyzer();
//Search by multiple fields
MultiFieldQueryParser parser = new MultiFieldQueryParser
how do I use these fields in SolrNet?
Thanks