Deepak Talape
Deepak Talape

Reputation: 997

Lucene Query in alfresco for Exact property match only

I am using below query to search document. My first query is=

TYPE:"hr:hrdoctype" AND @cm\:name:"E1"

and my second query is=

TYPE:"hr:hrdoctype" AND @cm\:name:"E2"

Here its giving the proper result.

But there is one problem, that if i will use

TYPE:"hr:hrdoctype" AND @cm\:name:"E"

Then it is displaying both records that is E1 and E2. But I don't have any record with name E. So is there any to get exact match?

Here, my requirement is if I search with name E it should not have to display any record. The record should display only when exact match occurs.

Can anyone help me with this requirement?

I think it happens because of it is tokenized in alfresco for full text search. But my requirement is different.

I am using alfresco 5.0.d

Please provide a way.

Thanks in advance.

Upvotes: 2

Views: 2176

Answers (1)

Tahir Malik
Tahir Malik

Reputation: 6643

There is a way to do an 'exact match', take a look here.

So for example in your case it would look like:

TYPE:"hr:hrdoctype" AND =@cm\:name:"E"

Be sure to search with FTS so it knows the exact search match. In javascript it will look like:

var query = "TYPE:\"hr:hrdoctype\" AND =@cm\\:name:\"E\";
var def = {
       query: query ,
       language: "fts-alfresco" 
};
var results = search.query(def);

Upvotes: 8

Related Questions