cancel
Showing results for 
Search instead for 
Did you mean: 

Searching documents in alfresco

pjain1
Champ in-the-making
Champ in-the-making
I am trying to search for documents with particular keyword. I tried xpath but it would search only in the document names and not content. I tried Lucene but it would just return the node path and not the actual documents that contain the keywords.
Following are the queries for both that I am using.

Workspace workspace = session.getWorkspace();
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery("//app:company_home/m8:HomePage/*[contains('weather')]", Query.XPATH);


SearchParameters searchParameters = new SearchParameters();
          StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
          searchParameters.addStore(storeRef);
          searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
          
          String query = "PATH:\"/app:*/m8:*//*\" +TEXT:\"TWENTYFOURHRPRECIP\"";
2 REPLIES 2

rdanner
Champ in-the-making
Champ in-the-making
queryManager.createQuery("//app:company_home/m8:HomePage/*[contains('weather')]", Query.XPATH);

Looks like you are not telling the query to look at the content itself

An Example would be:
//app:company_home/cm:repository/cm:csmonitor/cm:article/cm:Y2007/cm:M09/cmSmiley Very Happy10/*[@cm:content[contains('tariffs')]]

amit_wmw
Champ in-the-making
Champ in-the-making
Hello

Can you please advice on how to do a lucene search for content in all spaces under company_home or rootNode? i.e if we don’t want search to be limited to a specific space, but it should search in all hierarchy then how should we be going about that?  Please suggest.

Thanks
Amit.