开发者

Solr not matching. Threshold setting, or something weird?

开发者 https://www.devze.com 2023-04-09 10:01 出处:网络
I\'m using solr to search for articles. I created 2 test \"body\" sentences which have the common word \"tall\", but there is no match.

I'm using solr to search for articles. I created 2 test "body" sentences which have the common word "tall", but there is no match.

The Query---> Body:"There are tall people outside" AND !UserId:2

Does not match a post with:

Body:开发者_如何转开发 the KU tower is really tall UserId:3

Is this just simply a very low matching score? or is there something else going on here? In the case of a low matching score should it really be that low? The body sentences are very short and share a common word, I would have expected some match.

EDIT: I think the matching isn't happening as a result of having the !UserId: 2 condition. If I try to match body sentences without that, its very liberal. Can anyone explain this? and perhaps how to best structure a query to avoid this type of specific behavior?

Thanks!


I have seen some funky behavior with the ! operator with Solr. I would suggest you use the - (negative indicator) instead as shown in the SolrQuerySyntax Wiki Page. Try changing your original query to Body:"There are tall people outside" AND -UserId:2 to see if that works as you are expecting.


For those who come after me, I found a solution however not necessarily an explanation for its behavior.

The Solr query:

(PostBody:There are tall people outside) AND !UserId:2

worked as I desired above. Note that if the quotes are added around the body, it does not match. I believe Solr attempts to match such a query as a single string rather than individual words.

0

精彩评论

暂无评论...
验证码 换一张
取 消