You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2022/04/15 08:10:48 UTC

[GitHub] [lucenenet] bbieniek opened a new issue, #632: Cannot parse 'XX*': Encountered ""

bbieniek opened a new issue, #632:
URL: https://github.com/apache/lucenenet/issues/632

   Hi,
   
   We are right now on the following versions:
   ```
   <PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
   <PackageReference Include="Lucene.Net.QueryParser" Version="4.8.0-beta00016" />
   ```
   
   Today, we have encountered a random error, that could not be reproduced:
   ```
   Cannot parse 'Bl*': Encountered "<EOF>" at line 1, column 18.
   Was expecting one of:
       <BAREOPER> ...
       "(" ...
       "*" ...
       <QUOTED> ...
       <TERM> ...
       <PREFIXTERM> ...
       <WILDTERM> ...
       <REGEXPTERM> ...
       "[" ...
       "{" ...
       <NUMBER> ...
       <TERM> ...
       "*" ...
       
   ```
   
   ![image](https://user-images.githubusercontent.com/10694177/163543907-8a6ae858-23b3-430b-a622-b917935f9257.png)
   
   We use MultiFieldQueryParser with two fields and the following call:
   `Parse($"{input}*")`
   
   What could be the cause of it?
   The data is read from Azure Blob storage, using AzureDirectory package.
   
   Thank you for your help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] NightOwl888 commented on issue #632: Cannot parse 'XX*': Encountered ""

Posted by GitBox <gi...@apache.org>.
NightOwl888 commented on issue #632:
URL: https://github.com/apache/lucenenet/issues/632#issuecomment-1100187973

   What datatype is `{input}`?
   
   I suspect you might be having parse issues due to the culture of the current thread in your application, which may be formatting `{input}` in an unexpected way. You may need to use [`FormattableString.Invariant()`](https://docs.microsoft.com/en-us/dotnet/api/system.formattablestring.invariant?view=net-6.0).
   
   Note also that the parsing may be failing because a new `QueryParser` instance uses the culture of the current thread by default and you may need to change the culture.
   
   ```c#
   var parser = new MultiFieldQueryParser(LuceneVersion.LUCENE_48, new string[] { "foo", "bar" }, analyzer)
   {
       Locale = CultureInfo.InvariantCulture
   };
   ```
   
   Whatever the case, you should be able to debug what is happening by recording the culture and value to be parsed during a failure and then you should reproduce the issue in a debug environment so you can step through to debug. Note that you can [enable Source Link](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/core/source-stepping.html) on 4.8.0-beta00016 so you can step into the QueryParser code also.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] bbieniek commented on issue #632: Cannot parse 'XX*': Encountered ""

Posted by GitBox <gi...@apache.org>.
bbieniek commented on issue #632:
URL: https://github.com/apache/lucenenet/issues/632#issuecomment-1104820839

   After deploying the fix, it did not help.
   Still getting the exception:
   ```
   Cannot parse '"a"': Encountered "<EOF>" at line 1, column 2.
   Was expecting one of:
       <NOT> ...
       "+" ...
       "-" ...
       <BAREOPER> ...
       "(" ...
       "*" ...
       <QUOTED> ...
       <TERM> ...
       <PREFIXTERM> ...
       <WILDTERM> ...
       <REGEXPTERM> ...
       "[" ...
       "{" ...
       <NUMBER> ...
       <TERM> ...
       "*" ...
       
   ```
   
   One more thing, I am using the AzureDirectory package. I have noticed that this *may* occur when the cache is being downloaded from a blob container. I will ask the person that takes care of the Lucene.Net.Store.AzureDirectory package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] bbieniek commented on issue #632: Cannot parse 'XX*': Encountered ""

Posted by GitBox <gi...@apache.org>.
bbieniek commented on issue #632:
URL: https://github.com/apache/lucenenet/issues/632#issuecomment-1100190923

   It's a string.
   The problem is that this happened just in one instance. I wasn't able to reproduce it when running the parsing on exactly the same string.
   
   Thanks for the tip regarding Locale, I will try that and see if the error repeats


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org