1

I have a query

   t1 = query.Term("content", "field")
   t2 = query.Term("content", "information")
   t3 = query.Term("content", "document")
   q = spans.SpanNear2([t1, t2, t3], slop=5, ordered=True)

finds and marks individual words.

[information] A [field] is a piece [document] create [document] of [information] for each [document] in the index,...

but I need to mark whole correct expression. (?)

information A [field is a piece document create document of information for each document] in the index,...

arman
  • 141
  • 1
  • 11

1 Answers1

0

There has already been some reasearch on this topic. I haven't personnally tried it but it might be helpful:

  • Another SO thread on the matter: 1
  • To match a full phrase you can use phrase queries: 2
  • Apparently some unofficial code has been written regarding this issue: 3
elmo_N
  • 1
  • Please include all the relevant information in the answer, or flag the question as duplicate if it has an answer somewhere else. – Marc Sances Dec 28 '22 at 13:47