Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The "FunctionQuery" page has been changed by GrantIngersoll.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=33&rev2=34

--------------------------------------------------

  
   . Returns the number of milliseconds that {{{b}}} occurs before {{{a}}} 
(i.e. {{{a - b}}}).  Note that this offers higher precision than '''sub(a,b)''' 
because the arguments are not converted to floating point numbers before 
subtraction. Example: '''ms(NOW,mydatefield)''' Example: 
'''ms(mydatefield,2000-01-01T00:00:00Z)''' Example: 
'''ms(datefield1,datefield2)'''
  
+ === Date Boosting ===
+ Boosting more recent content is a common use case.  One way is to use a 
{{{recip}}} function in conjunction with {{{ms}}}.
+ 
+ There are approximately 3.16e10 milliseconds in a year, so one can scale 
dates to fractions of a year with the inverse, or 3.16e-11. Thus the function 
'''recip(ms(NOW,mydatefield),3.16e-11,1,1)''' will yield values near 1 for very 
recent documents, 1/2 for documents a year old, 1/3 for documents two years 
old, etc. Be careful to not use this function for dates more than one year in 
the future or the values will be negative.
+ 
+ The most effective way to use such a boost is to multiply it with the 
relevancy score, rather than add it in. One way to do this is with the 
[[http://lucene.apache.org/solr/api/org/apache/solr/search/BoostQParserPlugin.html|boost]]
 query parser.
+ 
+ Also see 
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
+ 
  == dist ==
  [[Solr1.5]] This is uncommitted code.  See: 
https://issues.apache.org/jira/browse/SOLR-1302
  
@@ -198, +207 @@

  
  Signature: deg(!ValueSource), rad(!ValueSource)
  
- === Date Boosting ===
- Boosting more recent content is a common use case.  One way is to use a 
{{{recip}}} function in conjunction with {{{ms}}}.
  
- There are approximately 3.16e10 milliseconds in a year, so one can scale 
dates to fractions of a year with the inverse, or 3.16e-11.  Thus the function 
'''recip(ms(NOW,mydatefield),3.16e-11,1,1)''' will yield values near 1 for very 
recent documents, 1/2 for documents a year old, 1/3 for documents two years 
old, etc.  Be careful to not use this function for dates more than one year in 
the future or the values will be negative.
- 
- The most effective way to use such a boost is to multiply it with the 
relevancy score, rather than add it in.  One way to do this is with the 
[[http://lucene.apache.org/solr/api/org/apache/solr/search/BoostQParserPlugin.html|boost]]
 query parser.
- 
- Also see 
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
  
  == top ==
  <!> [[Solr1.4]] Causes it's function query argument to derive it's values 
from the top-level IndexReader containing all parts of an index.  For example, 
the ordinal of a value in a single segment will be different from the ordinal 
of that same value in the complete index.  The ord() and rord() functions 
implicitly use top() and hence ord(foo) is equivalent to top(ord(foo)).

Reply via email to