Search code examples
javasolrsolrj

Negative Boost SolrJ bq


I am writing parameters into a bq query via a solrj implementation application. Some of my fields I want to negative boost (i.e. (id: -abc123)^3) as shown here but whenever I search I get logging errors:

"org.apache.solr.search.SyntaxError: Cannot parse"

and it shows the query exactly as it should be written (and how it works from the web applet). Why won't it parse properly in SolrJ but will via HTML?


Solution

  • Query like:

    bq=(-id:abc123)^3
    

    Boosts everything other than doc with id=abc123.

    You can try to reduce score of that document with query like:

    bq=(id:abc123)^0.3
    

    In project I'm working on at tied that, but at the end of the day I used boosting during indexing (I'm doing that based on document "class"). That solution works for me just fine.