[ 
https://issues.apache.org/jira/browse/NIFI-3248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15769702#comment-15769702
 ] 

Koji Kawamura commented on NIFI-3248:
-------------------------------------

I confirmed that the expected document is returned with square bracket, but not 
with curly bracket as shown in attached screenshots.
Solr documentation uses square brackets to specify date range:
https://cwiki.apache.org/confluence/display/solr/Working+with+Dates

But by testing more with different scheduling settings, I found that somehow 
NiFi is able to fetch newly added documents.
It seems if GetSolr runs before the added documents is committed, the document 
will be never fetched.



> GetSolr cannot query newly added documents due to incorrect date range filter
> -----------------------------------------------------------------------------
>
>                 Key: NIFI-3248
>                 URL: https://issues.apache.org/jira/browse/NIFI-3248
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.0.0, 0.5.0, 0.6.0, 0.5.1, 0.7.0, 0.6.1, 1.1.0, 0.7.1, 
> 1.0.1
>            Reporter: Koji Kawamura
>         Attachments: nifi-flow.png, query-result-with-curly-bracket.png, 
> query-result-with-square-bracket.png
>
>
> GetSolr holds the last query timestamp so that it only fetches documents 
> those have been added since the last query.
> However, since the timestamp filter is not properly formatted as a valid time 
> range filter, GetSolr never fetches newly added documents.
> The code has been the same in the [0.5 
> branch|https://github.com/apache/nifi/blob/support/nifi-0.5.x/nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/main/java/org/apache/nifi/processors/solr/GetSolr.java#L202],
>  so it seems it hasn't been working as expected.
> {code}
>         // if initialized then apply a filter to restrict results from the 
> last end time til now
>         if (initialized) {
>             StringBuilder filterQuery = new StringBuilder();
>             filterQuery.append(context.getProperty(DATE_FIELD).getValue())
>                     // This should be a square bracket :[
>                     .append(":{").append(lastEndDatedRef.get()).append(" TO ")
>                     .append(currDate).append("]");
>             solrQuery.addFilterQuery(filterQuery.toString());
>             logger.info("Applying filter query {}", new 
> Object[]{filterQuery.toString()});
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to