It's impossible to tell for sure from the info you provided -- attachments
are not included in messages on this mailing list - but my guess is that
when you use the QueryParser api you are getting a query that has the
benefit of text processing using an Analyzer (lower-casing and other text
transformations are done by an Analyzer), but TermQuery just matches
exactly the term you give it, without any such processing.

On Mon, Jul 16, 2018 at 11:02 AM Ashish Parab <ashish.para...@gmail.com>
wrote:

> Hi Team,
>
> I am new to Lucene and been exploring Lucene 7.4.0  for past few months.
>
> please take a look at attached IndexFiles.java, in which I am indexing all
> the files present under specified folder. also for every document, a field
> namely ashish is stored.
>
> now the indexing is ready, I am trying to search it via TermQuery api.
> code(SearchFiles_Mine.java) for the same is also attached.
>
>
> My issue is when I use TermQuery I get 0 hit where as if same thing is
> tried via QueryParser api it gives 10 hit.
>
> why is this happening? will you explain the functionality TermQuery API,
> in the context of my code ?
>
> regards,
> Ashish Parab
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to