tamaramata / solrnet

Automatically exported from code.google.com/p/solrnet
0 stars 0 forks source link

Set default search fields in Apache Solr #217

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to Implement[Apache Solr search through SolrNet library.So far I 
have managed to run an instance of Solr in my machine and make some queries 
based on specific fields.
My code to do it looks like this

       var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
       var results = solr.Query(new SolrQueryByField("id", "SP2514N"));

This one works fine now,But I would like to make queries with out specifying a 
field , So that when I enter a search key word solr will look in to the all 
fields available and return a result.I have Found the code to make it in 
SolrNet library from [here][3]

            var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
            var results = solr.Query(new SolrQuery("SP2514N"));

But this never worked,When I drilled down to bottom ,I found that I need to set 
default search fields in Solr instance so that Solr will search that fields 
when nothing else is selected(This is how i understood it I am not sure about 
this).
So I went to set default fields in Solr ,I took Solrconfig.XML and edited it 
like this

        <requestHandler name="/query" class="solr.SearchHandler" default="true">
         <lst name="defaults">
           <str name="echoParams">explicit</str>
           <str name="wt">json</str>
           <str name="indent">true</str>
           <str name="df">text</str>
           <str name="df">id</str>
         </lst>
      </requestHandler>

[just added  `<str name="df">id</str>` this field as extra].But this too never 
helped And I am stuck ,Can any one tell me How I could set default search field 
in Solr correctly?Or am i doing any thing else wrong?
My solrconfig file is attached to this question

Original issue reported on code.google.com by a...@phases.dk on 9 Oct 2013 at 8:29

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, this issue tracker is no longer used (as explained in the page that comes 
up when you click the "Issues" tab). Also, this is not an issue, and so it 
belongs in the mailing list: http://groups.google.com/group/solrnet

Cheers

Original comment by mauricio...@gmail.com on 11 Oct 2013 at 3:09

GoogleCodeExporter commented 8 years ago

Original comment by mauricio...@gmail.com on 11 Oct 2013 at 3:09