You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2017/06/09 16:07:38 UTC

[1/2] lucene-solr:master: Ref Guide: Add knn documentations

Repository: lucene-solr
Updated Branches:
  refs/heads/master df74c6550 -> 1dab10e81


Ref Guide: Add knn documentations


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1dab10e8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1dab10e8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1dab10e8

Branch: refs/heads/master
Commit: 1dab10e817868e98b7f5120bbcac4188ebb6f49a
Parents: 463907a
Author: Joel Bernstein <jb...@apache.org>
Authored: Fri Jun 9 11:55:11 2017 -0400
Committer: Joel Bernstein <jb...@apache.org>
Committed: Fri Jun 9 12:07:28 2017 -0400

----------------------------------------------------------------------
 solr/solr-ref-guide/src/stream-sources.adoc | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1dab10e8/solr/solr-ref-guide/src/stream-sources.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/stream-sources.adoc b/solr/solr-ref-guide/src/stream-sources.adoc
index 973d135..e77fc14 100644
--- a/solr/solr-ref-guide/src/stream-sources.adoc
+++ b/solr/solr-ref-guide/src/stream-sources.adoc
@@ -217,6 +217,36 @@ features(collection1,
 
 The `gatherNodes` function provides breadth-first graph traversal. For details, see the section <<graph-traversal.adoc#graph-traversal,Graph Traversal>>.
 
+== knn
+
+The `knn` function returns the K nearest neighbors for a document based on text similarity. Under the covers the `knn` function
+use the More Like This query parser plugin.
+
+=== knn Parameters
+
+* `collection`: (Mandatory) The collection to perform the search in.
+* `id`: (Mandatory) The id of the source document to begin the knn search from.
+* `qf`: (Mandatory) The query field used to compare documents.
+* `fl`: (Mandatory) The field list returned.
+* `mintf`: (Mandatory) The minimum numer of occurrences of the term in the source document to be inlcued in the search.
+* `maxtf`: (Mandatory) The maximum numer of occurrences of the term in the source document to be inlcued in the search.
+* `mindf`: (Mandatory) The minimum numer of occurrences in the corpus to be inlcued in the search.
+* `maxdf`: (Mandatory) The maximum numer of occurrences in the corpus to be inlcued in the search.
+* `minwl`: (Mandatory) The minimum world length of to be inlcued in the search.
+* `maxwl`: (Mandatory) The maximum world length of to be inlcued in the search.
+
+=== knn Syntax
+
+[source,text]
+----
+knn(collection1,
+    id="doc1",
+    qf="text_field",
+    fl="id, title",
+    mintf="3",
+    maxdf="10000000")
+----
+
 == model
 
 The `model` function retrieves and caches logistic regression text classification models that are stored in a SolrCloud collection. The `model` function is designed to work with models that are created by the <<train,train function>>, but can also be used to retrieve text classification models trained outside of Solr, as long as they conform to the specified format. After the model is retrieved it can be used by the <<stream-decorators.adoc#classify,classify function>> to classify documents.
@@ -404,6 +434,7 @@ JSON Facet API as its high performance aggregation engine.
 * `start`: (Mandatory) The start of the time series expressed in Solr date or date math syntax.
 * `end`: (Mandatory) The end of the time series expressed in Solr date or date math syntax.
 * `gap`: (Mandatory) The time gap between time series aggregation points expressed in Solr date math syntax.
+* `format`: (Optional) Date template to format the date field in the output tuples. Formatting is performed by Java's SimpleDateFormat class.
 * `metrics`: (Mandatory) The metrics to include in the result tuple. Current supported metrics are `sum(col)`, `avg(col)`, `min(col)`, `max(col)` and `count(*)`
 
 === timeseries Syntax
@@ -416,6 +447,7 @@ timeseries(collection1,
            start="NOW-30DAYS",
            end="NOW",
            gap="+1DAY",
+           format="YYYY-MM-dd",
            sum(a_i),
            max(a_i),
            max(a_f),


[2/2] lucene-solr:master: SOLR-10855: Null pointer exceptions in CartesianProductStream toExpression and explain methods

Posted by jb...@apache.org.
SOLR-10855: Null pointer exceptions in CartesianProductStream toExpression and explain methods


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/463907a1
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/463907a1
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/463907a1

Branch: refs/heads/master
Commit: 463907a13c461e35df4a260f2b7edc2a0adf122c
Parents: df74c65
Author: Joel Bernstein <jb...@apache.org>
Authored: Thu Jun 8 20:55:20 2017 -0400
Committer: Joel Bernstein <jb...@apache.org>
Committed: Fri Jun 9 12:07:28 2017 -0400

----------------------------------------------------------------------
 .../client/solrj/io/stream/CartesianProductStream.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/463907a1/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java
index 6514ae4..c96b9fe 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java
@@ -150,8 +150,10 @@ public class CartesianProductStream extends TupleStream implements Expressible {
     for(NamedEvaluator evaluator : evaluators) {
       expression.addParameter(String.format(Locale.ROOT, "%s as %s", evaluator.getEvaluator().toExpression(factory), evaluator.getName()));
     }
-    
-    expression.addParameter(new StreamExpressionNamedParameter("productSort", orderBy.toExpression(factory)));
+
+    if(orderBy != null) {
+      expression.addParameter(new StreamExpressionNamedParameter("productSort", orderBy.toExpression(factory)));
+    }
     
     return expression;   
   }
@@ -171,8 +173,10 @@ public class CartesianProductStream extends TupleStream implements Expressible {
     for(NamedEvaluator evaluator : evaluators){
       explanation.addHelper(evaluator.getEvaluator().toExplanation(factory));
     }
-    
-    explanation.addHelper(orderBy.toExplanation(factory));
+
+    if(orderBy != null) {
+      explanation.addHelper(orderBy.toExplanation(factory));
+    }
     
     return explanation;
   }