Wow, i never know this syntax before. What's that called? On 11/19/10, Yonik Seeley <yo...@lucidimagination.com> wrote: > 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? > > Yes, you must currently quote tokens if they contain whitespace - > otherwise the query parser first breaks on whitespace before doing > analysis on each part separately. > > Using dismax is an odd choice if you are only querying on keyphrase though. > You might look at the field query parser - it is a basic single-field > single-value parser with no operators (hence no need to escape any > special characters). > > q={!field f=keyphrase}smart%20mobile > > or you can decompose it using param dereferencing (sometimes easier to > construct) > > q={!field f=keyphrase v=$qq}&qq=smart%20mobile > > -Yonik > http://www.lucidimagination.com >
-- Sent from my mobile device Chhorn Chamnap http://chamnapchhorn.blogspot.com/