On Feb 7, 2006, at 5:47 AM, Simon Porritt wrote:
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!

For one thing, you have to be careful with case-sensitivity here. If you indexed "New York" and did a TermQuery for "new york" you wouldn't find it. You'll likely want to lower-case the text that gets indexed at least, and also do that on the querying side.

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.

Have a look at the PerFieldAnalyzerWrapper and the use of a KeywordAnalyzer (found in the latest codebase, and in Lucene in Action's free code download).

        Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to