cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene Search property value exact match[NodeBrowser]

dave984
Champ in-the-making
Champ in-the-making
Hi, i'm looking for the correct syntax for searching with Lucene an exact value for my custom property. I've searched a lot here in the forum but without result…
So Alfresco 4.2.c here is the property in my custom model(sure it works, i can see it in the share interface):

<aspect name="myCustomAspect:productContentAspect">
  <title>My Custom Aspect</title>
  <parent>myCustomAspect:aspect</parent>
  <properties>
    <property name="myCustomAspect:myProp">
      <type>d:text</type>
      <mandatory>false</mandatory>
    </property>
  </properties>      
</aspect>


So in the NodeBrowser of Alfresco i type:
+PATH:"/app:company_home/st:sites/cm:mySite/cm:documentLibrary/cm:repository/*" AND @myCustomAspect\:myProp:"value"
ALfresco recognize my custom property but give me as the results the following:
value
valueOne
valueTwo
valueThree

My goal is to retrieve only the file with myProp=value…
7 REPLIES 7

rjohnson
Star Contributor
Star Contributor
If there are only the 4 documents in the path then I think that


+PATH:"/app:company_home/st:sites/cm:mySite/cm:documentLibrary/cm:repository/*" AND +@myCustomAspect\:myProp:"value"


should do the trick. Without the + in front of a query item its a "may" not a "must" so it will return all 4 documents because they are all in the path. The property content check will be irrelevant. If you added a fifth with myProp as "nothing" I would expect that to be returned as well with your original query. Adding the + should make it compulsory to have myProp = "value".

Bob

mitpatoliya
Star Collaborator
Star Collaborator
Try just removing the double quotes from the value

replace "value" to value

dave984
Champ in-the-making
Champ in-the-making
Thank you for your support, but i've already tried both the tricks, referring also to the documentation:
http://wiki.alfresco.com/wiki/Search
but it didn't work…in the path there are more and more documents with property myProp blank but i don't see them in the search…
Could it be a problem of indexing and tokenization, referring also to this page maybe i've to add a property in my custom model?
http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fsearch-fts-...

rjohnson
Star Contributor
Star Contributor
You say you have more and more documents with myProp blank and you don't see them in the search. If myProp is blank in the document, given your search is looking for the word value, why would you expect to see them in the search?

dave984
Champ in-the-making
Champ in-the-making
Bob, excuse me…just a misunderstanding…i was referring to this:
<cite>
The property content check will be irrelevant. If you added a fifth with myProp as "nothing" I would expect that to be returned as well with your original query.
</cite>
simply it's not true…i don't see the file with the blank property in my search…

i am still not able to find precisely what i search with Lucene…very strange…

sanket
Champ on-the-rise
Champ on-the-rise
I faced a similar issue. But it seems that the above discussion was in with reference to an older alfresco version.
I am working with Alfresco4.1.3.
I made my exact search work by prefixing the property name with "=" operator.
For example:  =cm:customproperty:"abc"

Courtesy : http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Frm-searchsy...

Other option is to make the tokenized attribute to false in your model file.
http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fsearch-fts-...

iblanco
Confirmed Champ
Confirmed Champ
Hi Sanket,

You are right using = will do the trick but only for AFTS, Alfresco Full Text Search, not for lucene query syntax. I can't find a way to do it with Lucene, it might not be posible at all.

By the way this is the new URL for the place you stated: http://docs.alfresco.com/4.2/concepts/rm-searchsyntax-exact.html