lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: matching "starts with" only
Date Wed, 13 Aug 2014 16:32:13 GMT
I'd recommend that you spend some time with the
admin/analysis page.

KeywordTokenizer doesn't break up the input at _all_. So
the text "this is a black cat" will never match anything that
starts out "black". String is even more restrictive, it not only doesn't
tokenize, it won't allow lower case.

You haven't articulated the use-case you're really trying to support.
Is it a requirement that you always match from the left? I.e. if the
text is "this is a black cat" you don't want to match on "black cat", but
require "this is a black cat"? If so try EdgeNgramTokenizer.

Best,
Erick


On Tue, Aug 12, 2014 at 11:47 PM, zameer <zameerulhasan121@gmail.com> wrote:

> On solr3.6 search while giving query "black\ cat*"(as you mentioned in
> post),
> I am not getting any result.
> Instead of "black\ cat*" if I am querying "black*\ cat*", its giving result
> as
> black forest cat
> black cat
> black color cat.
>
> But I need only these type result i.e.
> black cat
> black cat is beautiful
> black cat and dog
>
> Note: I am using solr3.6
>
>
> Erick Erickson wrote
> > Right, this is a quirk of phrase queries. For wildcards to work in phrase
> > queries you need SOLR-1604 (ComplexPhraseQueryParser).
> >
> > Or you need to escape your spaces, i.e.
> > black\ cat*
> >
> > Best,
> > Erick
> >
> >
> > On Tue, Aug 5, 2014 at 11:09 PM, zameer &lt;
>
> > zameerulhasan121@
>
> > &gt; wrote:
> >
> >> If we search only "black*" it works but when we use search text "black
> >> cat*"
> >> or "(black cat)*" or "(black cat*)*" it come blank.
> >>
> >>
> > <fieldType name="text_general_long" class="solr.TextField"
> >>
> >  positionIncrementGap="100">
> >>
> > <analyzer>
> >>
> > <tokenizer class="solr.KeywordTokenizerFactory"/>
> >>
> > <filter class="solr.LowerCaseFilterFactory"/>
> >>
> > </analyzer>
> >>
> > </fieldType>
> >>
> >>
> > <field indexed="true" name="my_name" stored="true"
> >>
> >  type="text_general_long"/>
> >>
> >> Thank you in advance
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://lucene.472066.n3.nabble.com/matching-starts-with-only-tp4094430p4151379.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/matching-starts-with-only-tp4094430p4152662.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message