当前位置: 动力学知识库 > 问答 > 编程问答 >

search - Using an "AND" query with Lucene

问题描述:

I'm very new to Lucene.net (2.9.4), and I'm attempting to search using a MultiFieldQueryParser. I'm not getting the results back I expect. I've searched for answers to no avail...wonder if someone can assist...

Take the following records (strings) of items that have been indexed:

  • Medical Advisory Board Bios
  • Medical Advisory Board
  • A presentation - Speaker Bios

When I search for:

advisory, I'd expect to get 1 & 2 back, which I do.

When I search for advisory AND bios, I'd expect to get just 1 back, but it seems to be treating the AND as an or and I get all three results back...

What am I missing about the AND? The docs seem to say you can do this straight-forward out of the box. Thanks for the help...

网友答案:

After spending hours on this yesterday, I just tried it again, and it worked. Seems as if it requires capital letters for boolean operators, which I'm quite positive I was testing with, but, I must not have been. Hope this helps seomeone else...

分享给朋友:
您可能感兴趣的文章:
随机阅读: