Atai Voltaire
Atai Voltaire

Reputation: 133

Lucene boost & proximity query

when indexing my documents I boosted part of the documents (using doc.setBoost).

Everything is working fine beside when using proximity query:

"your proximity query"~30

wont take in account the boost factor.

Is boosting not supported with proximity query ?

below the explain output for query: "woman the"~30

all the results output look like:

0.0 = (NON-MATCH) weight(/d:"woman the"~30 in 342), product of:
  1.0 = queryWeight(/d:"woman the"~30), product of:
    2.0 = idf(/d: woman=82 the=12031)
    0.5 = queryNorm
  0.0 = fieldWeight(/d:"woman the" in 342), product of:
    0.0 = tf(phraseFreq=0.33333334)
    2.0 = idf(/d: woman=82 the=12031)
    3.0 = fieldNorm(field=/d, doc=342)

any help will be really appreciate.

thx,I.

Upvotes: 0

Views: 693

Answers (2)

NickJHoran
NickJHoran

Reputation: 607

Why not boost at query time? The advantage is that you can tweak the proximity and boost settings without having to worry about reindexing your documents:

"your proximity query"~30^10

Or

myField:"your proximity query"~30^10

Hope this helps.

Upvotes: 0

femtoRgon
femtoRgon

Reputation: 33341

Document.setBoost is not supported in the latest versions of Lucene. What it actually did, in older versions, was multiply the set document boost into each of a documents field boosts. In effect, there is not really any such thing as a Document boost, that's just a convenience method for setting a bunch of field boosts.

Field boosts (and Document boosts) are combined together with a LengthNorm factor, and are compressed (lossily) and stored in the index (see Similarity.computeNorm). This is the fieldNorm value you see. The original value you set for the Document level boost, by the time you retrieve the Document from the index, has been lost through these computational steps, and is not retrievable.

Upvotes: 1

Related Questions