lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NightOwl888 <>
Subject [GitHub] lucenenet pull request #176: QueryParser
Date Tue, 02 Aug 2016 14:39:14 GMT
GitHub user NightOwl888 opened a pull request:


    I have ported much of the QueryParser + the tests.
    Current Status
    Most of (about 2/3) of the tests are passing. The good news is that the Classic.QueryParser
is passing on all tests (except for one that I was unable to translate).
    Not Yet Ported
    1. The entire QueryParser.Flexible namespace.
    2. The [QueryParser.Surround.Query.SrndTruncQuery.VisitMatchingTerms](
    3. The [TestDateRange](
test for the classic QueryParser.
    Points of Interest
    1. The [Locale and Timezone](
features of the QueryParser seem a bit incompatible with .NET. The TimeZone property is not
actually hooked to anything since there doesn't seem to be a sensible way to use it in .NET.
And in .NET we normally set the culture on the current thread or pass it to a method for a
one-off. It doesn't make a lot of sense to make it a member of QueryParser, since a single
parser instance could be used on different cultures just by switching the culture of the current
thread. Thoughts?
    2. I refactored the [QueryParserConstants](
a bit since it is not possible to add constants to an interface as was done in Java. I weighed
the options and ended up splitting them into separate static classes, since there doesn't
seem to be a way to reference them in .NET from multiple classes (at least not without a base
class) without putting an identifier before the member (`Something.Constant`). I went with
`RegexpToken` and `LexicalToken` based on what was in the comments, but feel free to rename
them or suggest a different approach.
    3. I think that it would be best to use a `[Flags]` enum in .NET for the [`SimpleQueryParser`
since passing these flags to the API as an `int` is not very intuitive. However, currently
there are 9 tests failing that all directly involve these constants and I don't want to throw
another variable in to the debugging effort. I would be happy to change this as soon as the
tests are passing if you agree with this assertion.
    4. I ended up adding a couple of flags to `SimpleQueryParser` to [indicate a "not set"
since it is not possible to set an enum to null in .NET and IMO a nullable variable type should
not be part of a public API.
    5. I have run into a wall with debugging the 9 failing tests on the `SimpleQueryParser`.
The [documentation](
and [comments](
both indicate that passing a flag is to *enable* the option. However, the [test names](
indicate they are testing to *disable* the feature. As a result the wrong type of query is
being returned to pass the tests.
    6. I have also run into a wall with the failing tests (which are all of the tests) for
the Surround.Parser.QueryParser. For example [this test](
first correctly identifies the AND token, it then immediately tries to look for a `(` and
then blows up because it doesn't exist. I triple checked the code and is doing nothing more
than running the initialization code and then doing this check. A little assistance would
be appreciated, as I don't have the Java version setup to run to check what it *should* do.

You can merge this pull request into a Git repository by running:

    $ git pull queryparser

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #176
commit 9ecd633c012a6a64af77612bb2b98b3edcb46c02
Author: Shad Storhaug <>
Date:   2016-07-30T21:37:39Z

    Added QueryParser project and ported all of the Classic namespace files.

commit f3bc6a363bfecc048c7626b499b105d92a2641c8
Author: Shad Storhaug <>
Date:   2016-07-31T09:48:21Z

    Ported tests for the QueryParser.Classic namespace and refactored QueryParserTestBase
so the test runner will run all of the tests.

commit a696ce2168c0748edbe0a76b85449ca073aa261b
Author: Shad Storhaug <>
Date:   2016-07-31T10:12:18Z

    Refactoring to ensure that the abstract members are available in the context of the base
class test (otherwise many of the tests get a NotImplementedException on the QueryParserTestBase).

commit 44f59f1de4ef65ea6c886a1d15b80d576654927e
Author: Shad Storhaug <>
Date:   2016-07-31T11:43:14Z

    Changed QueryParserTokenManager line back to the way it was in Lucene.Net 3.0.3, although
it differs than the Java version, this appears to be correct in .NET.

commit ea7c7ca2614c21449b7526327b6599c0a04be611
Author: Shad Storhaug <>
Date:   2016-07-31T12:02:50Z

    Marked all IncrementToken() methods sealed in test TokenFilter classes.

commit f21ddf259cda41c84359bcfd1aa4324fdb0d7d97
Author: Shad Storhaug <>
Date:   2016-07-31T12:15:57Z

    Fixed issue with attributes not being set at the class level in MockCJKSynonymFilter.

commit 30e2532cf0fe4a6ee8724267e1c5ca1130488335
Author: Shad Storhaug <>
Date:   2016-07-31T12:20:57Z

    Fixed test name casing.

commit 4a39a91094811adfb9eb1ea1959c68692dde24aa
Author: Shad Storhaug <>
Date:   2016-07-31T13:12:20Z

    Fixed long/ulong casting issues in QueryParserTokenManager.

commit fc3501d9111251e9ae8b8144aaec32db12ccd155
Author: Shad Storhaug <>
Date:   2016-07-31T14:07:05Z

    Fixed Substring bugs because of the difference between the Java and .NET Substring function.

commit 3013048708ee84a2707677e0216952f4c4a54e08
Author: Shad Storhaug <>
Date:   2016-07-31T14:37:32Z

    Fixed bug in Lucene.Net.Util.ToStringUtils that was causing issues with the QueryParser
tests. Rolled the Boost(float) method back to the Lucene.Net 3.0.3 state.

commit db3b79bc143adda5df651857bc353a4e5b652eed
Author: Shad Storhaug <>
Date:   2016-07-31T18:51:25Z

    Added QueryParser.Analyzing namespace + tests.

commit 3d7dc6dfbe34c696b85b2bfd2201fcaede33224f
Author: Shad Storhaug <>
Date:   2016-07-31T20:03:29Z

    Ported QueryParser.ComplexPhrase namespace + tests.

commit a4f15f5d99e31f291c942cfe91d15dabf7d4baf5
Author: Shad Storhaug <>
Date:   2016-07-31T22:54:43Z

    Ported QueryParser.Ext namespace + tests.

commit a2df5d1675985be99a828cb9a15ff4f76510c169
Author: Shad Storhaug <>
Date:   2016-08-01T08:19:34Z

    Ported QueryParser.Simple namespace + tests.

commit 7337acd6aed52056a33917c8bc8efa5732eae7c2
Author: Shad Storhaug <>
Date:   2016-08-02T07:48:31Z

    Ported QueryParser.Surround namespace + tests.

commit 2f63706e8644b050159d3d104cbd508022a950b7
Author: Shad Storhaug <>
Date:   2016-08-02T07:48:49Z

    Updated comments.

commit be673c289b7db0b3a4135eef49384db7a6147a9a
Author: Shad Storhaug <>
Date:   2016-08-02T12:32:37Z

    Moved Lucene.Net.QueryParser and Lucene.Net.Tests.QueryParser projects into src\ directory.

commit ebfd19618e3646e0860c731617aa78917f3e31b2
Author: Shad Storhaug <>
Date:   2016-08-02T11:27:12Z

    Fixed accessibility of classes and members to match that of Java.

commit 0f40417a135055bb9b3dc65c94c381d2fd455ef0
Author: Shad Storhaug <>
Date:   2016-08-02T11:32:52Z

    Added missing guard clause to SimpleQueryParser.DefaultOperator.

commit 9e652a0c4e1a0a3f929da56b657b2f40575a6b4c
Author: Shad Storhaug <>
Date:   2016-08-02T11:38:01Z

    Added missing documentation to SpanNearClauseFactory

commit 0267b9cd8cab1931a121d2b3e434efb2f723a3b2
Author: Shad Storhaug <>
Date:   2016-08-02T11:48:04Z

    Removed unnecessary usings.


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message