Your analyzer treats "a" as a stopword, which makes sense for english but not in your case. You should use a different analyzer, maybe even skip analysis completely (ie. use StringField instead of TextField) since I suspect you only need exact matching on this category field.
FYI this email would have been better suited for the java-user list. Le mar. 22 août 2017 à 11:05, Balekundri, Manjunath V < [email protected]> a écrit : > Hi! > > > > As per jira-LUCENE-7932 discussions I am sending this mail along with my > java code(LuceneQueryTest.java class: attached) calling Lucene code. > > > > *A. **Code structure:* > > Attached sample code(LuceneQueryTest.java class) consists of 4 steps: > > 1. Create index (Needed to be executed only once to insert records) > > 2. Prepare query parameters > > 3. Prepare QueryParser object > > 4. Search and display results > > > > *B. **Analysis Report:* > > Step 1 can be executed only once because it creates index files first > time and then it can be commented. > > Step 2 has 3 cases > > Case a) queryParams = "LocationCode:1 AND Category:a"; > > Test analysis: When we execute this query all records are > fetched, even though we don’t have records of Category=a. *(Not working)* > > > > > > Case b) queryParams = "LocationCode:1 AND Category:A"; > > Test analysis: When we execute this query all records are > fetched, even though we don’t have records of Category=A. *(Not working)* > > > > Case c) queryParams = "LocationCode:1 AND Category:a*"; (Works Fine) > > Test analysis: When we execute this query No records are > fetched, this works fine. > > > > *C. **Submission to lucene development team:* > > Looking at case *a)* and case *b)* I think there is bug in Lucene > IndexSearcher.java or IndexReader.java in LuceneCore module. > > I used both Lucene 5.3 and latest version Lucene 6.6 to reproduce issue. I > found same results. > > > > If you need more information, please let me know. > > > > > > *Best regards,* > > *Rohit * > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected]
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
