Thursday, 8 June 2017

regex - Proximity of multiword phrases in Elasticsearch

Say you have two multi word phrases, one is "quick fox" and the other is "lazy brown".



The goal is to have 0 slop within the phrases and >0 slop between the phrases. Such that "quick fox" and "lazy brown" are matched without any extra words within either phrase but there could be multiple words between the two phrases.



So that the following should match:





  1. quick fox jumped over the lazy brown dog

  2. quick fox jumped 10 feet over and above the lazy brown dog

  3. quick fox jumped 10 feet over and above the lazy brown cat

  4. quick fox hopped over the lazy brown dog



But these will not:




  1. quick fast fox jumped over the lazy brown dog


  2. quick fox jumped over the lazy slow brown dog



Any ideas? I've been experimenting with span_near and span_multi but haven't gotten anywhere yet.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...