简体   繁体   English

露天餐厅中的Lucene查询仅用于完全匹配属性

[英]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 . 然后,它显示两个记录E1E2 But I don't have any record with name E . 但是我没有任何名为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. 在这里,我的要求是,如果我使用名称E it搜索, E it不必显示任何记录。 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. 我认为它的发生是因为它在alfresco用于全文搜索中被标记化。 But my requirement is different. 但是我的要求是不同的。

I am using alfresco 5.0.d 我正在使用alfresco 5.0.d

Please provide a way. 请提供一种方法。

Thanks in advance. 提前致谢。

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. 确保使用FTS进行搜索,以便知道确切的搜索匹配项。 In javascript it will look like: 在javascript中,它看起来像:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM