nutch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (NUTCH-2415) Create a JEXL based IndexingFilter
Date Tue, 29 Aug 2017 18:37:00 GMT


ASF GitHub Bot commented on NUTCH-2415:

jorgelbg commented on a change in pull request #219: NUTCH-2415 : Create a JEXL based IndexingFilter

 File path: src/plugin/index-jexl-filter/src/java/org/apache/nutch/indexer/filter/
 @@ -0,0 +1,119 @@
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.indexer.filter;
+import java.lang.invoke.MethodHandles;
+import java.util.Map.Entry;
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.MapContext;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.nutch.crawl.CrawlDatum;
+import org.apache.nutch.crawl.Inlinks;
+import org.apache.nutch.indexer.IndexingException;
+import org.apache.nutch.indexer.IndexingFilter;
+import org.apache.nutch.indexer.NutchDocument;
+import org.apache.nutch.indexer.NutchField;
+import org.apache.nutch.metadata.Metadata;
+import org.apache.nutch.parse.Parse;
+import org.apache.nutch.util.JexlUtil;
+import org.apache.nutch.util.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+ * An {@link org.apache.nutch.indexer.IndexingFilter} that allows filtering of
+ * documents based on a JEXL expression.
+ *
+ */
+public class JexlIndexingFilter implements IndexingFilter {
+	private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+	private Configuration conf;
+	private Expression expr;
+	@Override
+	public NutchDocument filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum,
Inlinks inlinks) throws IndexingException {
+	    if (expr != null) {
 Review comment:
   For what I see: `JexlUtil` returns null if it receives `null` or if cannot parse the expression:
   So if the expression cannot be parsed all the documents will be indexed because of this
check, should we do a more strict check? Because since if you already enable the plugin you
probably want your documents filtered (the plugin is not enabled by default).
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Create a JEXL based IndexingFilter
> ----------------------------------
>                 Key: NUTCH-2415
>                 URL:
>             Project: Nutch
>          Issue Type: New Feature
>          Components: plugin
>    Affects Versions: 1.13
>            Reporter: Yossi Tamari
>            Priority: Minor
> Following on NUTCH-2414 and NUTCH-2412, the requirement was raised for a IndexingFilter
plugin which will decide whether to index a document based on a JEXL expression.

This message was sent by Atlassian JIRA

View raw message