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 Felix Litman <f_...@pacbell.net> on 2007/04/07 00:41:09 UTC

Re: search on colon ":" ending words

We ended up using String newquery = query.replace(query, ":", 
with space in quotes after the ":".   It worked great. Now results come back even if you use
colon in the query.  And one can still use ":" as a special operator if there is no space 
afterwards.  Great suggestion.

Thanks!

Felix
-----------------------------------------------------
Finervista - http://www.finervista.com 

"Michael D. Curtin" <mi...@curtin.com> wrote: Felix Litman wrote:
> We want to be able to return a result regardless if users use a colon or not in the query.  So 'work:' and 'work' query should still return same result.
> 
> With the current parser if a user enters 'work:'  with a ":" , Lucene does not return anything :-(.   It seems to me the Lucene parser issue.... we are wondering if there is any simple way to make the Lucene parser ignore the ":" in the query?

The StandardAnalyzer already strips out the colons from the indexed 
text, so all you need to do is get rid of them in the query.  Would

   String newquery = query.replace(query, ":", " ");

work?  It uses a space as the new text so that two query words that 
happened to be separated by the colon would still be separate words ...

--MDC

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