cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene Search

luisg
Champ in-the-making
Champ in-the-making
Hi there…

I'm developing a GWT application that uses the Alfresco Repository.

In my application I do some lucene searches in the Alfresco repository, but I start notice that something is wrong. So, I started to use the node browser to test the querys I use, and I found what is going on.

The thing is, If I do the query:

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType"

I get the following results:

teste_psql.sql
moredataModel.xml
estrutura_expediente.dia

And this is right (these are some documents that I have in my desktop and just added them to alfresco).

the strange thing is, if I do the query:

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:"teste_psql.sql"

nothing is found… The same happens for the file sigpoaModel.xml BUT not for the file estrutura_expediente.dia!!!!

If I do the query:

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:"estrutura_expediente.dia"

I get the right result!

Can someone tell me what is going on?  :x

Thanks

Luis Gonçalves
7 REPLIES 7

luisg
Champ in-the-making
Champ in-the-making
Hi again…
I have some news here…

If I do the query:

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:moredataModel.xml*

I get the right result. But for the file teste_psql.sql I had tried

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:teste_psql.sql*

and

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:*teste_psql.sql*

even

PATH:"/app:company_home/cm:FolderA/cm:FolderB/cm:FolderC//*" AND TYPE:"{http://www.model.pt/model/content/1.0}myType" AND @cm\:name:teste*

and none of them worked.

thanks

lucille_arkenst
Champ in-the-making
Champ in-the-making
Luis,
I share the same frustration with Lucene Search.  I want to look into it a bit more.  First, can you post the link that explains to write the code this way?
Thanks,
Lucille

luisg
Champ in-the-making
Champ in-the-making
Hi…

I solved my problem, searching the documents by its id, and not for its name.

But I think this is something that should be clarified.
In my code I used the code (in java):


String query = "PATH:\""+path+"//*\" AND " +
                    "TYPE:\"{http://www.mymodel.pt/model/content/1.0}document\" AND " +
                    "@cm\\:name:\""+documentName+"\"";

Query q = new Query(Constants.QUERY_LANG_LUCENE, query);
QueryResult queryResult = getRepositoryService().query(STORE, q, false);
org.alfresco.webservice.types.ResultSet resultSet = queryResult.getResultSet();

But when the program will fail in the line:


Reference reference = new Reference(STORE, rows[0].getNode().getId(), null);

Giving me a nullPointerException, cause the query don't give me any results.

But, as I told you before, if I execute the query:

PATH:""+path+"//*" AND TYPE:"{http://www.mymodel.pt/model/content/1.0}document"

The document is in the list, but I don't get the document passing its name.

Luis Gonçalves

alex54
Champ on-the-rise
Champ on-the-rise
Is your indexation state OK ? (I mean the synchronisation between data and indexes)
because it look like a out of synch problem…

maqsood
Confirmed Champ
Confirmed Champ
Hi luisg,

Did you get any solution for your problem? Iam also facing similar kind of problem.

msvoren
Champ in-the-making
Champ in-the-making
Try to reindex your whole reposiory.
Include following line in your repository properties file:

index.recovery.mode=FULL

and restart alfresco.

Lucene starts to behave in strange manner if indexes are not synced.
About that, can anyone answer why this happens and what one can do to prevent this happening?
This is very unpleasant if it happens on production servers..

maqsood
Confirmed Champ
Confirmed Champ
Hi msvoren,

Thanks for your help. but it didn't seem to be work out for me…  Smiley Sad
Any other solution?