You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Christopher Currens (JIRA)" <ji...@apache.org> on 2011/06/10 01:26:03 UTC

[Lucene.Net] [jira] [Created] (LUCENENET-423) QueryParser differences between Java and .NET

QueryParser differences between Java and .NET
---------------------------------------------

                 Key: LUCENENET-423
                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
             Project: Lucene.Net
          Issue Type: Bug
    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
            Reporter: Christopher Currens


When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:

{code:java}
var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
{code}

You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().

It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049377#comment-13049377 ] 

Digy commented on LUCENENET-423:
--------------------------------

I don't think there is an inconsistency between the Java version and .NET.
If you know that the field is indexed as "date", then you should give your date-string (while searching) in the form the language can parse.
(And both languages UIs return datetime string parseble by other libraries. It is not common that the user types the datetime string in a textbox)

DIGY

> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Christopher Currens (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148616#comment-13148616 ] 

Christopher Currens commented on LUCENENET-423:
-----------------------------------------------

I still don't know 100% how I feel about this.  To be honest, I guess I don't understand the group's stance on how compatible we want to be with java.  I don't want to get into it too deep here, but my understanding is we wanted to be as close to java as possible, and the differences in how .NET and Java can parse a datetime seem minor, but are just as important, in my opinion.

The problem is that .NET actually can parse more kinds of strings into date times than Java, and that may not be a bad thing, a .NET developer may expect that, but the difference in behavior is still my main concern.  Either way, I'm willing to go in whatever direction the group decides.
                
> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Troy Howard (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148661#comment-13148661 ] 

Troy Howard commented on LUCENENET-423:
---------------------------------------

I don't think this is the same debate of ".NET vs Java". 

Essentially, two things should be true about any Lucene implementation: the index files are interchangeable and the same query will return the same results regardless. How it works under the hood and what the API looks like is where the debate normally focuses. There's no reason we couldn't enforce compatibility on the query parser so that it behaves the same on both platforms.

In my opinion this is a bug that needs to be fixed, possibly in both Java Lucene and .NET Lucene... There should be a standardized method of expressing dates as strings, which is consistent across all implementations VS just using whatever the various platforms support via their datetime parser.
                
> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET when parsing range queries involving dates

Posted by "Christopher Currens (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13236155#comment-13236155 ] 

Christopher Currens commented on LUCENENET-423:
-----------------------------------------------

For backwards compatibility, I've decided it's probably best to implement this conditionally based on the Version passed to the QueryParser's constructor.

>From LUCENE_30 and onward, it will now parse the dates similar to how java does it, using on the ShortDatePattern on the CurrentCulture's FormatInfo.  The old behavior of parsing any date style will be present if any earlier version is specified.
                
> QueryParser differences between Java and .NET when parsing range queries involving dates
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>             Fix For: Lucene.Net 3.0.3
>
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047089#comment-13047089 ] 

Digy commented on LUCENENET-423:
--------------------------------

Maybe I am missing something,
but I run your code both in .NET & Java(not Luke) and printed query.ToString().
>>Same Result(in base36).

DIGY

> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[Lucene.Net] [jira] [Updated] (LUCENENET-423) QueryParser differences between Java and .NET when parsing range queries involving dates

Posted by "Christopher Currens (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Currens updated LUCENENET-423:
------------------------------------------

    Fix Version/s: Lucene.Net 3.0.3
          Summary: QueryParser differences between Java and .NET when parsing range queries involving dates  (was: QueryParser differences between Java and .NET)

This is a difference of behavior between searching in Java and .NET.  While .NET is more accurate about DateTime parsing, that difference in behavior seems to be against what was discussed [in this email thread|http://mail-archives.apache.org/mod_mbox/lucene-lucene-net-dev/201112.mbox/%3CCAFZAm_VxWaNZmCAUZPFt2%2B9HJBXJjSTmJ-uLj%3DQh-naGja9MKA%40mail.gmail.com%3E], regarding people's wishes for the future of the project.  Much of what was agreed upon was the project having much of the same behavior of Java, in that indexes are compatible and searches in each returning the same results for the same search on the same index.
                
> QueryParser differences between Java and .NET when parsing range queries involving dates
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>             Fix For: Lucene.Net 3.0.3
>
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Christopher Currens (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049334#comment-13049334 ] 

Christopher Currens commented on LUCENENET-423:
-----------------------------------------------

.NET is far better at parsing date string, but it's the inconsistency between the Java version and .NET version that I'm worried about.  Search the index with one query from java and you get different results with the same query in .Net.

How compatible do we want to be with Java?

> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047179#comment-13047179 ] 

Digy commented on LUCENENET-423:
--------------------------------

You are right, I used a different date string.

.Net seems to parse the date-strings better.
I would leave it as is.

DIGY

> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (LUCENENET-423) QueryParser differences between Java and .NET when parsing range queries involving dates

Posted by "Christopher Currens (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Currens closed LUCENENET-423.
-----------------------------------------

    Resolution: Fixed

Fixed with LUCENENET-478.  Either it was old or ported incorrectly, but the Java version uses DateFormat.SHORT to parse the date, which has a .NET equivalent.

It's not a perfect port, however.  With java, in my locale, these two string parse just fine in java:

"1/1/2002" and "1/1/2002jab89034jh134oijgb"

They will both return the same date.  With .NET, the latter fails.  Mostly for performance reasons, I didn't want to first TryParseExact the string and then check try to emulate Java.  Seems like something we could document for those who want to use DateFields in 3.x.

If Version.LUCENE_29 or earlier is passed to the QueryParser, the old behavior where .NET parses more dates than Java does, specifically dates with dashes instead of forward slashes, for those who want the old behavior.
                
> QueryParser differences between Java and .NET when parsing range queries involving dates
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>             Fix For: Lucene.Net 3.0.3
>
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Prescott Nasser (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148537#comment-13148537 ] 

Prescott Nasser commented on LUCENENET-423:
-------------------------------------------

Seems like we want to keep this as it? Should we close this?
                
> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Lucene.Net] [jira] [Commented] (LUCENENET-423) QueryParser differences between Java and .NET

Posted by "Prescott Nasser (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148637#comment-13148637 ] 

Prescott Nasser commented on LUCENENET-423:
-------------------------------------------

I'm going to leave this as is and not do anything for 2.9.4. The .NET vs similar to Java is a bigger conversation that we definitely should have.
                
> QueryParser differences between Java and .NET
> ---------------------------------------------
>
>                 Key: LUCENENET-423
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-423
>             Project: Lucene.Net
>          Issue Type: Bug
>    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Christopher Currens
>
> When trying to do a RangeQuery that uses dates in a certain format, .NET behaves differently from its Java counterpart.  The code is the same between them, but as far as I can tell, it appears that it is a difference in the way Java parses dates vs how .NET parses dates.  To reproduce:
> {code:java}
> var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "FullText", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
> var query = queryParser.Parse("Field:[2001-01-17 TO 2001-01-20]");
> {code}
> You'll notice that query looks like the old DateField format (eg "0g1d64542").  If you do the same query in Java (or Luke), you'll notice the query gets parsed as if it were a RangeQuery of string.  AFAIK, Java cannot parse a string formatted in that way.  If you change the string to use / instead of - in the java, you'll get one that uses DateResolutions and DateTools.DateToString().
> It seems an appropriate fix for this, if we wanted to keep this behavior similar to Java, would be to write our own DateTime parser that behaved the same way to Java's parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira