Search code examples
solrsolrj

Solr Field does not return results


Solr does not return the results until I prefix the :field name for example I am searching for Ajay,I need to prefix name:Ajay to get the results.I tried the copy tag.But it does not seem to return the results.Can you please tell me what can I change other than the below change.

<copyField source="name" dest="text"/>
<copyField source="last_name" dest="text"/>

Solution

  • The old way this was configured was with <defaultSearchField> in schema.xml. This indicates the field searched by default if no other field is included in the query.

    You may want to either use the df parameter in the query (or as the other answer says, add it as a default value), or if you're using the (e)dismax handler (which you probably are), use the qf parameter to indicate which fields to query and the weights between the different fields.

    q=Ajay&qf=text&defType=edismax
    

    .. should do what you want.