I'd be very grateful if someone could help me with this, I do hope someone can
I'll try and provide as much info as possible so to avoid confusion as to what my question is. Client requirement
: Client has a table that holds articles in one column, think of them as digital newspaper articles. They have a search webpage to find articles that match the user's keywords. Along with this search functionality the user can specify the proximity that the keywords must be from each other to qualify. Basically how many words (not characters) one word must be from the other to return true. Search Example:
If the user specifies 5 words apart and enters the search term as 'search word', then the query should return all rows where an article contains the words 'search' and 'word' and they are no more than 5 words apart.Result exampleTrue
because only 2 words apart from each other: 'This is a search that has word in it'False
because 7 words apart from each other: 'The search will not come out true because the word is more than 5 words apart.'Added complexity 1:
This seems reasonable enough however there is the added complexity that you could have more than two search keywords, in which case they must all be within the specified word proximity. Added complexity 2:
The whole article must be searched not just the first occurance of a keyword.
i.e. if we use the example:
Search keyword: 'search word' within 5 words...
Article: 'The search will not come out true because the word is more than 5 words apart. But this is a search that has word in it.'
The above is true because the second sentence contains the keywords within 5 words proximity even if the first sentence did not.
I know that Full Text Search has the ability to use the operator NEAR however in 2008 you can not set a proximity limit that the words must be from each other. I know that 2012 does but because I am running on 2008 I need to find a way to programatically do this.
Please oh please can someone help me. Right now I am stuck and do not know how to do this.
Many thanks in advance, :-)