0

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?

2 Answers2

0

i wouldn't advise using BQ as it is an additive boost. It's rather hard to predict the influence as it depends on term frequency and overall query score. You can try using the BOOST parameter with function value inside, like if(exists(query({!v='id:abc123'})),1/3,1) - so that the document having abc123 has its score multiplied by 1/3

lexk
  • 761
  • 3
  • 7
  • hmm that does seem like it could be a better fit. a few questions regarding syntax: what does the final argument (the 1) represent? also, do I need single quotes for my ID strings? I also need to put in multiple IDs, how would I write that? would I use an OR operator? – user2494021 Jul 24 '13 at 20:02
  • the meaning is to put 1/3 if the value exists and 1 otherwise. Since it's multiplicative 1 means no boost, 1/3 means negative boost. If you have several ids, you may use OR - it's a regular query syntax. – lexk Jul 25 '13 at 18:16
0

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.

Fuxi
  • 5,298
  • 3
  • 25
  • 35