Alex, Thanks for your quick reply. This has almost worked!
'id' was an int field with omitNorms set to true. I set it to false, so my schema.xml has now got: --- <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0" omitNorms="false"/> <field name="id" type="int" indexed="true" stored="true" required="true" /> --- I am getting the following output now: 50.60443 = (MATCH) weight(id:`#8;#0;#0;#2;#20; in 0) [DefaultSimilarity], result of: 50.60443 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 5.060443 = idf(docFreq=1, maxDocs=116)10.0 = fieldNorm(doc=0) Why is the fieldNorm 10.0, instead of 11.1111? I changed precisionStep of int to 8, which gives: 25.302216 = (MATCH) weight(id:`#8;#0;#0;#2;#20; in 0) [DefaultSimilarity], result of: 25.302216 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 5.060443 = idf(docFreq=1, maxDocs=116) 5.0 = fieldNorm(doc=0) and precisionStep of 4 gives, 17.71155 = (MATCH) weight(id:`#8;#0;#0;#2;#20; in 0) [DefaultSimilarity], result of: 17.71155 = fieldWeight in 0, product of:1.0 = tf(freq=1.0), with freq of:1.0 = termFreq=1.0 5.060443 = idf(docFreq=1, maxDocs=116)3.5 = fieldNorm(doc=0) both of which don't make sense to me. On Tue, May 21, 2013 at 4:18 PM, Alexandre Rafalovitch <arafa...@gmail.com>wrote: > I believe the document level boost translates into boosts for all the > fields. If so, the question is what type your fields are. The > primitive fields (int, bool, and - importantly - string) do not have > boosts enabled by default. Try setting omitNorms=false on field > definition and see if the reindexing will help. Search for omitNorms > at http://wiki.apache.org/solr/SchemaXml for more details. > > Regards, > Alex. > Personal blog: http://blog.outerthoughts.com/ > LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch > - Time is the quality of nature that keeps events from happening all > at once. Lately, it doesn't seem to be working. (Anonymous - via GTD > book) > > > On Tue, May 21, 2013 at 7:13 PM, Arun Rangarajan > <arunrangara...@gmail.com> wrote: > > Solr version: 4.2.1 > > > > As explained here: > > https://wiki.apache.org/solr/DataImportHandler#Special_Commands, I am > > trying to use index-time document-level boost in data import handler. I > > have a database table 'boosts' in which the document boosts are stored > > against the solr unique key. > > > > In data-config.xml, I am using: > > > > <entity name="xxx" > > pk="id" > > query="SELECT d.id, d.name, b.boost AS '$docBoost' FROM documents d > LEFT > > JOIN boosts b ON d.id = b.id WHERE d.id < 117"/> > > > > There are a total of 116 results for that query. (I am assuming LEFT JOIN > > is the correct thing to do here, so missing entries will get NULL for > > $docBoost, so they should get the default boost of 1.) > > > > For testing, I have the boosts table with only 1 row for id 1 with a > boost > > of 11.1111 > > mysql> SELECT * FROM boosts\G > > ********************** > > id: 1 > > boost: 11.1111 > > ********************** > > > > When I issue this query > > > http://localhost:8983/solr/CORE/select?q=id:1&fl=id,name,score&wt=xml&debuqQuery=on > > I am seeing the output as follows: > > > > 5.060443 = (MATCH) weight(id:`#8;#0;#0;#2;#20; in 0) [DefaultSimilarity], > > result of: 5.060443 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), > > with freq of: 1.0 = termFreq=1.0 5.060443 = idf(docFreq=1, maxDocs=116) > 1.0 > > = fieldNorm(doc=0) > > > > > > I don't see the index-time boost of 11.1111 for this document anywhere in > > the score, so what am I doing wrong? > > > > I tried adding a tfloat field named '$docBoost' in schema.xml, but that > > didn't help either. Getting same score. > > > > Thanks. >