AnsweredAssumed Answered

Unable to search on name fragment

Question asked by hsjawanda on Dec 22, 2005
Latest reply on Jan 4, 2006 by andy
Hi all,

I am constructing a lucene query to search for names (folder and content names – this is a field of type "cm:name").  I have a number of gifs that are named <stem>_ani.gif. The <stem> contains underscores.

If I search for "ani.gif*", I get the results I want. If I use any other search term ("*ani*", "*gif" or something from the <stem> part of the filename), I get nothing.

Here's the query that yields the desired results:

( @\{http\://\}name:'ani.gif*")
( @\{http\://\}description:'ani.gif*")

And here are queries that don't return anything:
Query 1:

( @\{http\://\}name:'ani*")
( @\{http\://\}description:'ani*")

Query 2:

( @\{http\://\}name:'*ani*")
( @\{http\://\}description:'*ani*")

Query 3:

( @\{http\://\}name:'*gif*")
( @\{http\://\}description:'*gif*")

Also, there are some description fields that contain the word "desperate". I get results only if I search for the whole word – searching for "desp*" returns no results.

Can anybody help explain whats going on?  The searching behaviour doesn't seem to match the examples given in

Looks like searching is tokenizing and can only return results when a whole token is matched.  If this is correct, what characters does Lucene (as used in Alfresco) tokenize on (especially, does it tokenize on underscores)?

How can I change the indexing and/or the search query to search for files (content) based on extensions?  For example, I want to get a list of all gifs when I search for "*.gif".

All help greatly appreciated.  Thanks.