lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From baris.ka...@oracle.com
Subject Re: Not getting desired result through TermQuery
Date Wed, 18 Jul 2018 19:27:03 GMT
My problem seems similar to this one.

i make sure index has all lower cased and TermQuery search term also 
gets all lower cased.

i tokenize the search string since index uses standardtokenizer and 
standardfilter and lowecasefilter and asciifoldingfilter.

My index uses standardtokenizer and the following due to my second query 
requirements:

StandardFilter
LowerCaseFilter
ASCIIFoldingFilter
StopFilter


But given what i do for TermQuery as i listed above, it should still 
find some hits, right?

My Booleanquery is built by the builder:

booleanQueryBuilder.add((Query)queryArr.get(k), BooleanClause.Occur.MUST);


Best regards


On 7/18/18 3:22 PM, Michael Sokolov wrote:
> 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.parab23@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-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message