cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 2.0 Query for document properties

sniza23
Champ in-the-making
Champ in-the-making
Hi all,

I have trouble to use query for searching document.
I'm using  this…

Query query = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}title:\'my_title\"");
and it works fine but when I want to use WildCard search like this…

Query query = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}title:\'my_tit*\"");
it does not work. I will get response that document was not found. Is it problem of syntax, luciene or alfresco engine?

thanx
2 REPLIES 2

gis-olli
Champ in-the-making
Champ in-the-making
Hello, at first you can try to remove the " before and after your value. If this does not find your document, you can try to remove the + befor your search argument. Something like this:

Query query = new Query(Constants.QUERY_LANG_LUCENE, "@\\{http\\://www.alfresco.org/model/content/1.0\\}title:my_tit*");

This page may help you:

http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_text_property_values

andy
Champ on-the-rise
Champ on-the-rise
Hi

Wild cards in phrase queries are now supported. So your second example will work with the latest code.

For 2.0, in the second search example, the best you can do is tokenise the search yourself.

Query query = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}title:my \\{http\\://www.alfresco.org/model/content/1.0\\}title:tit*");

The down side is that the words could be in any order.

Andy