You can't, it's analyzed. And if you facet on a non-analyzed field, you cannot 
distinguish between upper- and lowercase tokens. If you want that, you must 
create a new field with an EdgeNGramTokenizer, search on it and then you can 
facet on a non-analyzed field. Your query will be a bit different then:

 

q=new_ngram_field:utr

rows=0

facet=true

facet.field=non_analyzed_city_field

 

 
-----Original message-----
From: PeterKerk <vettepa...@hotmail.com>
Sent: Fri 20-08-2010 12:36
To: solr-user@lucene.apache.org; 
Subject: RE: Autosuggest on PART of cityname


Ok, I now do this (searching for "utr" in cityname):
http://localhost:8983/solr/db/select/?wt=json&indent=on&q=*:*&rows=0&facet=true&facet.field=city&facet.prefix=utr

In the DB there's 1 location with cityname 'Utrecht' and the other 1 is with
'Utrecht Overvecht'

So in my dropdown I would like:
Utrecht (1)
Utrecht Overvecht (1)

But I get this:
{
"responseHeader":{
 "status":0,
 "QTime":0,
 "params":{
"facet":"true",
"indent":"on",
"q":"*:*",
"facet.prefix":"utr",
"facet.field":"city",
"wt":"json",
"rows":"0"}},
"response":{"numFound":6,"start":0,"docs":[]
},
"facet_counts":{
 "facet_queries":{},
 "facet_fields":{
"city":[
"utrecht",2,
"utrechtovervecht",1]},
 "facet_dates":{}}}

As you can see it looks at field city, where the tokenizer looks at each
individual word. I also tried city_raw, but that was without any results.

How can I fix that my dropdown will show the correct values?
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/Autosuggest-on-PART-of-cityname-tp1226088p1241444.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to