0

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!

DJSunny
  • 1,970
  • 3
  • 19
  • 27

2 Answers2

1

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.

Paige Cook
  • 22,415
  • 3
  • 57
  • 68
0

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.

DJSunny
  • 1,970
  • 3
  • 19
  • 27