cancel
Showing results for 
Search instead for 
Did you mean: 

problem in Lucene through web-service

wael_shaban
Champ in-the-making
Champ in-the-making
Hi,
I am trying to search in the repository using web-service and Lucene. My search depends on document metadata (properties). I am trying to search for document by name and owner (my custom document property).

I have the following problems:
1) If I created a document called "sample.txt" and search for it, search succeeded. But, if I delete the file and uploaded it again with the same name and try to search for it again, I get the following error:

Node does not exist: workspace://SpacesStore/3a8c490c-fcaf-11db-851c-ebd74aa2bd91

It appears that Lucene does not update its index and still have the same reference for old one (the deleted one).
What can I do to force the Lucene to reindex the document noting that I am using web-service API for all the work?

2) For my custom property "owner", I tried to search by using the two queries:

@\\{http\\://www.alfresco.org/model/content/1.0\\}owner:'test"
@owner\:"test"

But both fail and does not return result noting that there are documents that match the query criteria.
How can I solve this problem and can search by my custom properties?

Thanks in advance
3 REPLIES 3

putodemonio
Champ in-the-making
Champ in-the-making
I didn't know about your first problem, but I also have your second problem.

I have read in the Wiki (http://wiki.alfresco.com/wiki/Search_Documentation#Lucene_Language) about how to write the queries:

Attributes as fields
    @{namespace-uri}name


QName qname = QName.createQName(NamespaceService.ALFRESCO_URI, "int-ista");
results = searcher.query(storeRef, "lucene", "\\@" + escapeQName(qname) + ":\"01\"", null, null);

But:
1.- The NamespaceService is not available in WebServices API… is it?
2.- Wich class implements escapeQName???
3.- From wich package do I have to import the QName, because I have seen in a example javax.xml.namespace.QName, but it doesnt have the createQName static method
4.- Why in the wiki I have told, there are some fields wroten in green, like ASPECT, ID… and some others in red, like QNAME, @{namespace-uri}name
5.- If I try to write directly the namespace-uri, how do I have to write it?

Please, help!!!

rajvael
Champ in-the-making
Champ in-the-making
Below sample seach file contain text alfresco and creator should be an admin

queryString = "+PARENT:\"workspace://SpacesStore/"+<<Add Parent Node reference id>>; //(ex.)nodes[0].getReference().getUuid()

queryString = queryString+ " AND TEXT:\"alfresco\" AND \\@\\{http\\:\\/\\/www.alfresco.org\\/model\\/content\\/1.0\\}creator:admin";

Query query = new Query(Constants.QUERY_LANG_LUCENE, queryString );

Hope it will help.

putodemonio
Champ in-the-making
Champ in-the-making
Thank you very much, even three years from my question, hehehe!!!
I'll call my client to tell him I'm able to finish his project!! hahaha!!!

excuse my joke, hehe!

I suppose I resolved the problem… I dont remember how… posibly changing some funtionality…

ANYWAY, THANK YOU VERY MUCH!!!