paulirwin commented on issue #850:
URL: https://github.com/apache/lucenenet/issues/850#issuecomment-2442444314

   @suchoss Thanks for filing this report, but I have reproduced this in Java 
Lucene 4.8 and it produces the same result, therefore this is not a bug with 
our project. With modifications to the code below, I also reproduced the same 
result in Lucene 10.0.0. If you feel this is a bug, please file an issue with 
the upstream project. Thanks!
   
   ```java
   package org.example;
   
   import org.apache.lucene.analysis.Analyzer;
   import org.apache.lucene.analysis.TokenStream;
   import org.apache.lucene.analysis.Tokenizer;
   import org.apache.lucene.analysis.core.LowerCaseFilter;
   import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilter;
   import org.apache.lucene.analysis.standard.StandardFilter;
   import org.apache.lucene.analysis.standard.StandardTokenizer;
   import org.apache.lucene.util.Version;
   
   import java.io.Reader;
   
   public class DefaultQA extends Analyzer
   {
       private Version _version = Version.LUCENE_48;
   
       @Override
       protected TokenStreamComponents createComponents(String s, Reader 
reader) {
           Tokenizer tokenizer = new StandardTokenizer(_version, reader);
           TokenStream result = new StandardFilter(_version, tokenizer);
           result = new LowerCaseFilter(_version, result);
           result = new ASCIIFoldingFilter(result);
   
           return new TokenStreamComponents(tokenizer, result);
       }
   }
   ```
   
   ```java
   package org.example;
   
   import org.apache.lucene.queryparser.classic.ParseException;
   import org.apache.lucene.queryparser.classic.QueryParser;
   import org.apache.lucene.util.Version;
   
   public class Main {
       public static void main(String[] args) throws ParseException {
           var qa = new DefaultQA();
   
           var queryParser = new QueryParser(Version.LUCENE_48, "fieldName", 
qa);
           queryParser.setDefaultOperator(QueryParser.Operator.AND);
   
           var query = QueryParser.escape("more&more"); //this is the query I 
am trying to "parse"
   
           var searchQuery = queryParser.parse(query);
           var searchQuery2 = queryParser.createBooleanQuery("fieldName", 
query);
           var searchQuery3 = queryParser.createPhraseQuery("fieldName", query);
   
           System.out.println(searchQuery);
           System.out.println(searchQuery2);
           System.out.println(searchQuery3);
       }
   }
   ```
   
   output:
   ```
   +fieldName:more +fieldName:more
   fieldName:more fieldName:more
   fieldName:"more more"
   ```


-- 
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-unsubscr...@lucenenet.apache.org

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

Reply via email to