Karl Heinz Marbaise wrote:

I have a field which is called filename and contains a filename which can of course be lowercase or upppercase or a mixture...

I would like to do the following:

+filename:/*scm*.doc

That should result in getting things like

/...SCMtest.doc
/...scmtest.doc
/...scm.doc
etc.

May be someone can give me hint how to solve this...

It's all down to the analyzer you use when you index that field and how you choose to tokenize it. If you want to always search case insensitively, then you should lower case the filename when indexing.

Depending on how you implemented your query parser, if you have implemented wildcard query support, if it's anything like the standard QP, it will not put the query string through the analyzer, so a search for

+filename:/*SCm*.doc

would then not find anything, so you'd need to make sure you lower case all the filename field searches at some point.

I use a custom analyzer for filenames, which lower cases and tokenizes by letter or digit or any custom chars and my query parser supports custom analyzers for getFieldQuery().

If you want to keep the original filename, then just store the field as well as index it, then you can get the original back from the Document.

Antony


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

Reply via email to