lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Porritt <simon.porr...@dealchecker.co.uk>
Subject Search on Keyword rather than Text?
Date Tue, 07 Feb 2006 10:47:05 GMT
Hello,

We have a document type for which we wish to create an index that may 
contain spaces, and we don't want the values to be tokenized.  The data 
is a list of cities.  We are currently creating the index using Field.Text:

Field.Text("index", "New York")

...which of course means that the string is tokenized before being 
indexed.  Running this search:

new yo

which translates to

index:new index:yo

returns New York amongst the results, as well as any cities starting 
with 'yo' - not what we want.  For that search we want no results at 
all.  In fact we want that search to translate to

index:"new yo"

where the whole of "new yo" is considered the search term.  Of course in 
that example the presence of the quotes means that Lucene treats the 
term as if it must exist in its entirety, which we also don't want!

It looked like the solution was to use Field.Keyword:

Field.Keyword("index", "New York")

but now we get no results on any search at all!

We use a SimpleAnalyser for creating the index and running the 
searches.  If anyone has an idea that could steer us in the right 
direction we would be most appreciative.

Thanks,

Simon


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


Mime
View raw message