Search code examples
solrsolrj

Solr doesnot accepts unparsed query


I have added some documents in my solr index using requestHandler and now I am trying to query them from the web UI, I am getting the correct result when my query parameter is in the fomat

[id]:[search-item]

but i want to search it without parsing in this format, so for example i have to search for cat, i just type "cat" and it gives me the result, and not "animal:cat", I am new to solr so I am not very sure, where am I going wrong


Solution

  • Use the DisMax query parsers/handlers

    Extract from DisMax documentation

    The DisMax query parser is designed to process simple phrases (without complex syntax) entered by users and to search for individual terms across several fields using different weighting (boosts) based on the significance of each field. Additional options enable users to influence the score based on rules specific to each use case (independent of user input).

    In general, the DisMax query parser's interface is more like that of Google than the interface of the 'standard' Solr request handler. This similarity makes DisMax the appropriate query parser for many consumer applications. It accepts a simple syntax, and it rarely produces error messages.

    Also see DisMax and full documentation of the DisMax query parser here