[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: Lucene stringField EnglishAnalyzer serch nor working
From:       Erick Erickson <erickerickson () gmail ! com>
Date:       2018-07-20 17:57:53
Message-ID: CAN4YXvc0j0aZP8AMms4ySXrKeoRG0_a1HXazFrp-5EsXZ7JF7A () mail ! gmail ! com
[Download RAW message or body]

Why so complicated? Boosts do you no good,
you're only trying to find one document. Boosts influence
the score of documents in the ranking, but there's
only one.

I suspect if you looked at the debug form of the parsed query,
you'd find it pretty unexpected. You say it works  with
text fields, but I also suspect it's not doing quite what
you expect.

And it's all unnecessary and overly expensive anyway.
Just use a TermQuery. Term queries are very stupid and
do _no_ analysis of the term provided, they expect that
you already have done all that. They're very, very
efficient.

Best,
Erick

On Fri, Jul 20, 2018 at 9:30 AM, egorlex <egorlex@gmail.com> wrote:
> Hi Erick,
>
> Thanks for reply,
>
> In need find document by  uuid (random generated field).
>
> Example of create field in document:
>
> Document document = new Document();
> document.add(new StringField("uuid", product.getId() , Field.Store.YES));
>
> Example of query to search:
>
> Map<String, Float> boosts = new HashMap<>();
>       boosts.put("uuid", 1.0f);
>       boosts.put("name", 1.0f);
>
> String[] fields = new String[]{"uuid",  "name"};
>
> MultiFieldQueryParser multiQP = new MultiFieldQueryParser(fields,
> engAnalyzer, boosts);
> quary = multiQP.parse(query);
>
> TopDocs hits = sercher.search(query, maxResult, sort);
>
> I wont to find document by uuid but result is always empty.
>
> Everything works if i create document with text field
> document.add(new TextField("uuid", product.getId() , Field.Store.YES));
> But i need exact match... this approach good for name but not for uuid.
>
> Lucene version 7.3.0
>
> Thanks.
>
>
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html
>
> ---------------------------------------------------------------------
> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic