How to incorporate multiple fields in QueryParser?

后端 未结 4 970
无人共我
无人共我 2020-12-12 13:41
Dim qp1 As New QueryParser(\"filename\", New StandardAnalyzer())
Dim qp2 As New QueryParser(\"filetext\", New StandardAnalyzer())
.
.

I am using th

4条回答
  •  青春惊慌失措
    2020-12-12 14:43

    Just build a query string with each term:

    "filename:searchText OR filetext:searchText"
    

    It doesn't matter what you pass as the initial field in QueryParser's constructor. Just make sure you call .Parse() on your query string to get a Query object back to execute.

    If you want to use an "and" search:

    "+filename:searchText +filetext:searchText"
    

提交回复
热议问题