I would suggest using a QueryParser for your fuzzy query before adding it
to the Boolean query. This should weed out any case issues.

On Mon, 10 Jun 2019 at 8:06 PM, <baris.ka...@oracle.com> wrote:

> BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();
>
> //First set
>
>         booleanQuery.add(new FuzzyQuery(new
> org.apache.lucene.index.Term(field, "MAINS")), BooleanClause.Occur.SHOULD);
>          booleanQuery.add(Utils.createPhraseQuery(phraseAnalyzer, field,
> "NASHUA"), BooleanClause.Occur.MUST);
>          booleanQuery.add(Utils.createPhraseQuery(phraseAnalyzer, field,
> "NEW HAMPSHIRE"), BooleanClause.Occur.MUST);
>          booleanQuery.add(Utils.createPhraseQuery(phraseAnalyzer, field,
> "UNITED STATES"), BooleanClause.Occur.MUST);
>
> // Second set
>          //booleanQuery.add(new FuzzyQuery(new
> org.apache.lucene.index.Term(field, "street=\"MAINS\"")),
> BooleanClause.Occur.SHOULD);
> //booleanQuery.add(Utils.createPhraseQueryFullText(phraseAnalyzer,
> field, "city=\"NASHUA\""), BooleanClause.Occur.MUST);
> //booleanQuery.add(Utils.createPhraseQueryFullText(phraseAnalyzer,
> field, "region=\"NEW HAMPSHIRE\""), BooleanClause.Occur.MUST);
> //booleanQuery.add(Utils.createPhraseQueryFullText(phraseAnalyzer,
> field, "country=\"UNITED STATES\""), BooleanClause.Occur.MUST);
>
> The first set brings also street with Nashua name. (NASHUA).
>
> so, to prevent that and since i also indexed with street="..."
> city="..." i did the second set but it does not bring anything.
>
> createPhraseQuery builds a Phrasequery with one term equal to the string
> in the call.
>
> Best regards
>
>
>
> On 6/10/19 10:47 AM, baris.ka...@oracle.com wrote:
> > How do i check how it is indexed? lowecase or uppercase?
> >
> > only way is now to by testing.
> >
> > i am using standardanalyzer.
> >
> > Best regards
> >
> >
> > On 6/9/19 11:57 AM, Atri Sharma wrote:
> >> On Sun, Jun 9, 2019 at 8:53 PM Tomoko Uchida
> >> <tomoko.uchida.1...@gmail.com> wrote:
> >>> Hi,
> >>>
> >>> What analyzer do you use for the text field? Is the term "Main"
> >>> correctly indexed?
> >> Agreed. Also, it would be good if you could post your actual code.
> >>
> >> What analyzer are you using? If you are using StandardAnalyzer, then
> >> all of your terms while indexing will be lowercased, AFAIK, but your
> >> query will not be analyzed until you run a QueryParser on it.
> >>
> >>
> >> Atri
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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