LUCENE-5207: javadocs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1523385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-09-15 01:50:04 +00:00
parent de995715bd
commit c3229f37b0
2 changed files with 32 additions and 3 deletions

View File

@ -35,7 +35,21 @@ import org.apache.lucene.search.SortField;
/**
* Simple class that binds expression variable names to {@link SortField}s
* or other {@link Expression}s.
*
* <p>
* Example usage:
* <pre class="prettyprint">
* SimpleBindings bindings = new SimpleBindings();
* // document's text relevance score
* bindings.add(new SortField("_score", SortField.Type.SCORE));
* // integer NumericDocValues field (or from FieldCache)
* bindings.add(new SortField("popularity", SortField.Type.INT));
* // another expression
* bindings.add("recency", myRecencyExpression);
*
* // create a sort field in reverse order
* Sort sort = new Sort(expr.getSortField(bindings, true));
* </pre>
*
* @lucene.experimental
*/
public final class SimpleBindings extends Bindings {

View File

@ -61,7 +61,21 @@ import org.objectweb.asm.commons.GeneratorAdapter;
* </pre>
* <p>
* See the {@link org.apache.lucene.expressions.js package documentation} for
* the supported syntax and functions.
* the supported syntax and default functions.
* <p>
* You can compile with an alternate set of functions via {@link #compile(String, Map, ClassLoader)}.
* For example:
* <pre class="prettyprint">
* Map&lt;String,Method&gt; functions = new HashMap&lt;&gt;();
* // add all the default functions
* functions.putAll(JavascriptCompiler.DEFAULT_FUNCTIONS);
* // add cbrt()
* functions.put("cbrt", Math.class.getMethod("cbrt", double.class));
* // call compile with customized function map
* Expression foo = JavascriptCompiler.compile("cbrt(score)+ln(popularity)",
* functions,
* getClass().getClassLoader());
* </pre>
*
* @lucene.experimental
*/
@ -122,7 +136,8 @@ public class JavascriptCompiler {
/**
* Compiles the given expression with the supplied custom functions.
* <p>
* Functions must return {@code double} and can take from zero to 256 {@code double} parameters.
* Functions must be {@code public static}, return {@code double} and
* can take from zero to 256 {@code double} parameters.
*
* @param sourceText The expression to compile
* @param functions map of String names to functions