AnsweredAssumed Answered

Lucene query with extact phase?

Question asked by spilby on Jun 16, 2014
Latest reply on Aug 4, 2014 by spilby
I want to find with Lucene a node with a property. Exactly with this text. I'm using Alfresco 4.2 and the Alfresco Java API.

For example, imagine I have in Alfresco 2 nodes with my velocity_number property. One with the value "A B" and the other with the value "A B C".

On my webscript, I do this:


SearchParameters sp = new SearchParameters();
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(query);
ResultSet results = getSearchService().query(myQuery);
         

where myQuery is:      

PATH: "//app:company_home/app:user_homes/cm:dir//." AND @own\:velocity_number:"A B"


This query returns me the 2 nodes, "A B" and "A B C". I don't want this, I  only want "A B" node.


I thank that the solution was add an "=" character on the query, like this:


PATH: "//app:company_home/app:user_homes/cm:dir//." AND =@own\:velocity_number:"A B"


But don't find anything, the results is 0.

How is the query to find that I want?

If I do the same with the Node Browser of the Administration Console (with Lucene search) the same… 0 results. The character "=" only works for me if and find 1 result if I put the query on the Search combo on the Alfresco Explorer (advanced search).

Thanks!

Outcomes