cancel
Showing results for 
Search instead for 
Did you mean: 

Any idea why this Lucene search returns nothing?

jcblitz
Champ in-the-making
Champ in-the-making
I'm new to Alfresco and Lucene. I gave http://lucene.apache.org/java/docs/queryparsersyntax.html a read through but I don't see anything obvious of why this isn't returning anything.

I'm modifying the Query1.java example for the Web Service.

I've created the Query of
Query query = new Query(Constants.QUERY_LANG_LUCENE, "path:'/app:company_home/cm:" +ISO9075.encode("Pathology Reports")+"/*'");

but it's returning with "No query results found."

If I run the (almost) default query the example came with
Query query = new Query(Constants.QUERY_LANG_LUCENE, "TEXT:'pathology'");

one of the results is "row 1: {http://www.alfresco.org/model/content/1.0}path = /{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1...." which is what I'm trying to mimic with my query. Essentially get me everything in that path. Can anyone see what's wrong with my query?
2 REPLIES 2

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Here is the query

Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:" +ISO9075.encode("Pathology Reports")+"/*\"");

You need the escape the " in your code like above.

Below link should provide you with more information on Search

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


Best Regards,
Shagul Khaja,

jcblitz
Champ in-the-making
Champ in-the-making
Hi,

Here is the query

Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:"/app:company_home/cm:" +ISO9075.encode("Pathology Reports")+"/*"");

You need the escape the " in your code like above.

Below link should provide you with more information on Search

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


Best Regards,
Shagul Khaja,

Great, it worked. Thank you. I tried a mix of " vs ' but I guess not that one.