You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by mschipperheyn <m....@gmail.com> on 2012/01/21 16:38:54 UTC

Finding cityfuzzily but most accurate is most relevant

Hi,

I'm trying to select city names in a way that goes easy on the spelling
mistakes with the most accurate match first. My index for the city name
field is tokenized.
Let's say I'm looking for Rio de Janeiro.

When I search
A
+city:rio de j
I get 
Rio Tinto 1
Rio Azul 2
[...] 
Rio de Janeiro 58

This result is so large because of matching on all keywords, including "de",
which undesired. And even with this type of matching I would want Rio de
Janeiro on top as "the most relevant".

B
+city:"rio de j"
0 results

B
+city:"rio de j*"
0 results

C
+city:"rio de janeiro"~1
Rio de Janeiro

D
+city:"rio de j"~1
0 results

I would want to get this translated to +city:"rio de j*"~1

So, I guess I'm looking for a near phrase query with wild card.

Any suggestions on this?

Kind regards,
Marc

--
View this message in context: http://lucene.472066.n3.nabble.com/Finding-cityfuzzily-but-most-accurate-is-most-relevant-tp3677966p3677966.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding cityfuzzily but most accurate is most relevant

Posted by mschipperheyn <m....@gmail.com>.
Hey Rene,

Thanks for the quick response. I use Hibernate, so I can use the
programmatic API.

Marc

--
View this message in context: http://lucene.472066.n3.nabble.com/Finding-cityfuzzily-but-most-accurate-is-most-relevant-tp3677966p3678444.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding cityfuzzily but most accurate is most relevant

Posted by Rene Hackl-Sommer <re...@gmx.de>.
Hi Marc,

>  So, I guess I'm looking for a near phrase query with wild card.

>  Any suggestions on this?

Do you rely on the Lucene Query Syntax or can you build queries via the API?

If the latter, take a look at SpanNearQuery and SpanRegexQuery.

Here's an article that can get you started on SpanQueries: http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/

Cheers,
Rene



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org