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:

TEXT:"ani.gif*"
( @\{http\://www.alfresco.org/model/content/1.0\}name:'ani.gif*")
( @\{http\://www.alfresco.org/model/content/1.0\}description:'ani.gif*")

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

TEXT:"ani*"
( @\{http\://www.alfresco.org/model/content/1.0\}name:'ani*")
( @\{http\://www.alfresco.org/model/content/1.0\}description:'ani*")


Query 2:

TEXT:"*ani*"
( @\{http\://www.alfresco.org/model/content/1.0\}name:'*ani*")
( @\{http\://www.alfresco.org/model/content/1.0\}description:'*ani*")


Query 3:

TEXT:"*gif*"
( @\{http\://www.alfresco.org/model/content/1.0\}name:'*gif*")
( @\{http\://www.alfresco.org/model/content/1.0\}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 http://lucene.apache.org/java/docs/queryparsersyntax.html.

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.

Outcomes