Well, this field is a keyphrase. I want to make it to case-insensitive single token field. It matches only when the user types the same as data in solr.
What's wrong with that? Does it can be done in another way? On Thu, Nov 18, 2010 at 6:08 PM, Ahmet Arslan <iori...@yahoo.com> wrote: > This happening because query parser pre-tokenizes your query using whites > paces. It is tokenized before it reaches your query analyzer. > And you are using KeywordTokenizer in your field definition. > > Is there a special reason for you to use KeywordTokenizer ? > > > --- On Thu, 11/18/10, Chamnap Chhorn <chamnapchh...@gmail.com> wrote: > > > From: Chamnap Chhorn <chamnapchh...@gmail.com> > > Subject: Re: Must require quote with single word token query? > > To: solr-user@lucene.apache.org > > Date: Thursday, November 18, 2010, 5:19 AM > > Thanks for your reply. Here is some > > other details: > > > > 1. Keyphrase field definition: > > <field name="keyphrase" > > type="text_keyword" indexed="true" stored="false" > > multiValued="true"/> > > > > 2. I'm using solr 1.4. > > > > 3. My dismax definition is the original configuration after > > install solr: > > <requestHandler name="dismax" > > class="solr.SearchHandler" > > > <lst name="defaults"> > > <str > > name="defType">dismax</str> > > <str > > name="echoParams">explicit</str> > > <float > > name="tie">0.01</float> > > <str name="qf"> > > text^0.5 features^1.0 name^1.2 > > sku^1.5 id^10.0 manu^1.1 cat^1.4 > > </str> > > <str name="pf"> > > text^0.2 features^1.1 name^1.5 > > manu^1.4 manu_exact^1.9 > > </str> > > <str name="bf"> > > popularity^0.5 > > recip(price,1,1000,1000)^0.3 > > </str> > > <str name="fl"> > > id,name,price,score > > </str> > > <str name="mm"> > > 2<-1 5<-2 > > 6<90% > > </str> > > <int > > name="ps">100</int> > > <str > > name="q.alt">*:*</str> > > <!-- example highlighter > > config, enable per-query with hl=true --> > > <str name="hl.fl">text > > features name</str> > > <!-- for this field, we want no > > fragmenting, just highlighting --> > > <str > > name="f.name.hl.fragsize">0</str> > > <!-- instructs Solr to return > > the field itself if no query terms are > > found --> > > <str > > name="f.name.hl.alternateField">name</str> > > <str > > name="f.text.hl.fragmenter">regex</str> <!-- > > defined below --> > > </lst> > > </requestHandler> > > > > 4. Here is the result returned back of the original query: > > smart mobile. > > > > <?xml version="1.0" encoding="UTF-8"?> > > > > <response> > > > > <lst name="responseHeader"> > > <int name="status">0</int> > > > > <int name="QTime">1</int> > > <lst name="params"> > > > > <str name="debugQuery">on</str> > > <str name="fl">uuid,name,fap</str> > > > > <str name="indent">true</str> > > <str name="q">smart mobile</str> > > > > <str name="qf">keyphrase</str> > > <str name="defType">dismax</str> > > > > </lst> > > </lst> > > <result name="response" numFound="0" start="0"/> > > > > <lst name="debug"> > > > > <str name="rawquerystring">smart mobile</str> > > > > <str name="querystring">smart mobile</str> > > <str > > name="parsedquery">+((DisjunctionMaxQuery((keyphrase:smart)) > > DisjunctionMaxQuery((keyphrase:mobile)))~2) ()</str> > > > > <str > > name="parsedquery_toString">+(((keyphrase:smart) > > (keyphrase:mobile))~2) ()</str> > > > > <lst name="explain"/> > > <str name="QParser">DisMaxQParser</str> > > > > <null name="altquerystring"/> > > <null name="boostfuncs"/> > > > > <lst name="timing"> > > <double name="time">1.0</double> > > > > <lst name="prepare"> > > <double > > name="time">1.0</double> > > > > <lst > > name="org.apache.solr.handler.component.QueryComponent"> > > <double > > name="time">1.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.FacetComponent"> > > > > <double > > name="time">0.0</double> > > </lst> > > > > <lst > > name="org.apache.solr.handler.component.MoreLikeThisComponent"> > > <double > > name="time">0.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.HighlightComponent"> > > > > <double > > name="time">0.0</double> > > </lst> > > > > <lst > > name="org.apache.solr.handler.component.StatsComponent"> > > <double > > name="time">0.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.DebugComponent"> > > > > <double > > name="time">0.0</double> > > > > </lst> > > > > </lst> > > <lst name="process"> > > <double > > name="time">0.0</double> > > > > <lst > > name="org.apache.solr.handler.component.QueryComponent"> > > <double > > name="time">0.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.FacetComponent"> > > > > <double > > name="time">0.0</double> > > </lst> > > > > <lst > > name="org.apache.solr.handler.component.MoreLikeThisComponent"> > > <double > > name="time">0.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.HighlightComponent"> > > > > <double > > name="time">0.0</double> > > > > </lst> > > > > <lst > > name="org.apache.solr.handler.component.StatsComponent"> > > <double > > name="time">0.0</double> > > > > </lst> > > <lst > > name="org.apache.solr.handler.component.DebugComponent"> > > > > <double > > name="time">0.0</double> > > </lst> > > > > </lst> > > > > </lst> > > </lst> > > </response> > > > > 5. Here is parsed query with "smart mobile" (with quotes) > > which returns the > > result: > > > > <lst name="debug"> > > <str name="rawquerystring">"smart > > mobile"</str> > > > > <str name="querystring">"smart mobile"</str> > > > > > > <str > > name="parsedquery">+DisjunctionMaxQuery((keyphrase:smart > > mobile)) ()</str> > > > > <str name="parsedquery_toString">+(keyphrase:smart > > mobile) ()</str> > > > > <lst name="explain"> > > <str > > name="D297A64B-D4BA-4445-B63E-726E5A4F758D"> > > > > 4.503682 = (MATCH) sum of: > > 4.503682 = (MATCH) fieldWeight(keyphrase:smart > > mobile in 13092), product of: > > 1.0 = tf(termFreq(keyphrase:smart mobile)=1) > > 10.29413 = idf(docFreq=1, maxDocs=21748) > > 0.4375 = fieldNorm(field=keyphrase, > > doc=13092) > > > > </str> > > </lst> > > > > 6. Here, I tried to use automatic phrase query (pf > > parameter): doesn't > > return any results. > > > http://localhost:8081/solr/select?q=smart%20mobile&qf=keyphrase&pf=keyphrase&debugQuery=on&defType=dismax > > > > <str name="rawquerystring">smart mobile</str> > > > > <str name="querystring">smart mobile</str> > > <str > > name="parsedquery">+((DisjunctionMaxQuery((keyphrase:smart)) > > DisjunctionMaxQuery((keyphrase:mobile)))~2) > > DisjunctionMaxQuery((keyphrase:smart mobile))</str> > > > > <str > > name="parsedquery_toString">+(((keyphrase:smart) > > (keyphrase:mobile))~2) (keyphrase:smart > > mobile)</str> > > > > <lst name="explain"/> > > > > <str name="QParser">DisMaxQParser</str> > > > > <null name="altquerystring"/> > > <null name="boostfuncs"/> > > > > Thanks > > Chamnap > > > > On Wed, Nov 17, 2010 at 8:10 PM, Erick Erickson <erickerick...@gmail.com > >wrote: > > > > > Try qt=dismax or deftype=dismax, I was also getting 0 > > results with > > > defType on 1.4.1. I'll see what's up with that... > > > > > > But if that doesn't work... > > > > > > May we see your dismax definition too? You shouldn't > > need the > > > quotes, so something's wrong somewhere.... > > > > > > What version of Solr are you using? > > > > > > Also, please post the results of running your original > > query > > > with &debugQuery=on > > > > > > Best > > > Erick > > > > > > On Tue, Nov 16, 2010 at 10:28 PM, Chamnap Chhorn > > <chamnapchh...@gmail.com > > > >wrote: > > > > > > > I have one question related to single word token > > with dismax query. In > > > > order > > > > to be found I need to add the quote around the > > search query all the time. > > > > This is quite hard for me to do since it is part > > of full text search. > > > > > > > > Here is my solr query and field type definition > > (Solr 1.4): > > > > <fieldType name="text_keyword" > > class="solr.TextField" > > > > positionIncrementGap="100"> > > > > <analyzer> > > > > <tokenizer > > class="solr.KeywordTokenizerFactory"/> > > > > <filter > > class="solr.LowerCaseFilterFactory" /> > > > > <filter > > class="solr.TrimFilterFactory" /> > > > > <filter > > class="solr.StopFilterFactory" ignoreCase="true" > > > > words="stopwords.txt" > > enablePositionIncrements="true"/> > > > > <filter > > class="solr.SynonymFilterFactory" synonyms="synonyms.txt" > > > > ignoreCase="true" expand="false" /> > > > > <filter > > class="solr.RemoveDuplicatesTokenFilterFactory"/> > > > > </analyzer> > > > > </fieldType> > > > > > > > > <field name="keyphrase" > > type="text_keyword" indexed="true" > > > > stored="false" multiValued="true"/> > > > > > > > > With this query > > > > > q=smart%20mobile&qf=keyphrase&debugQuery=on&defType=dismax, > > > > solr returns nothing. However, with quote on the > > search query q="smart > > > > > > mobile"&qf=keyphrase&debugQuery=on&defType=dismax, > > the result is found. > > > > > > > > Is it a must to use quote for a single word token > > field? > > > > > > > > -- > > > > Chhorn Chamnap > > > > http://chamnapchhorn.blogspot.com/ > > > > > > > > > > > > > > > -- > > Chhorn Chamnap > > http://chamnapchhorn.blogspot.com/ > > > > > > -- Chhorn Chamnap http://chamnapchhorn.blogspot.com/