You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Balekundri, Manjunath V" <ma...@cgi.com> on 2017/08/22 07:26:01 UTC

LUCENE-7932:Search record with field value='a' or 'A' returns all records along with one more field value

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)

                [cid:image001.png@01D31B43.FCA9EDB0]



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)

[cid:image002.png@01D31B45.88BFA230]



Case c) queryParams = "LocationCode:1 AND Category:a*"; (Works Fine)

                Test analysis: When we execute this query No records are fetched, this works fine.

                [cid:image003.png@01D31B45.88BFA230]

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



Re: LUCENE-7932:Search record with field value='a' or 'A' returns all records along with one more field value

Posted by Adrien Grand <jp...@gmail.com>.
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 <
manjunath.balekundri@cgi.com> 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: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org