I am trying to incoporporate the ability to search on a single, specific character within a search index. The character is the letter "B", both upper and lower case, preceeded always by a space, and followed always by either a space OR a puncutation mark. For instance, I want a search hit on a phrase such as "Vitamin B is good for you," while at the same time, I want the search engine to ignore a phrase such as "it was basic beginner's luck".
In creating the search index, I've incorporated the following word matching expressions with only limited success:
-k"\alnum{2,30}" -k"[Bb]{1}"
I've also added <apipc qminwordlen 1> to the search script to allow single character word searches in the query string.
The above word matching expression, unfortunately, will return any article that simply contains the letter "B". This does make sense. Searches for any other single character other than a "B" result in a pretty ugly error, but that's okay for now.
I've attempted to get the index to only accept <space>-"B"-<space> and <space>-"B"-<punct> with no success using the following word pattern matching expressions:
-k"\alnum{2,30}" -k"[\s][Bb]{1}[\s]" -k"[\s][Bb]{1}[\punct]"
This returns an ugly error message no matter what single character search is performed, including "B".
In all cases, I get the error message indicating that the "query would require a linear search". But first things first....
Being somewhat unfamiliar with regular expressions, I could be way off in left field on the word pattern matching expressions...or maybe not. Either way, any assistance you could provide in helping me solve this problem would be greatly appreciated!
Thanks in advance,
Aaron Drielick
In creating the search index, I've incorporated the following word matching expressions with only limited success:
-k"\alnum{2,30}" -k"[Bb]{1}"
I've also added <apipc qminwordlen 1> to the search script to allow single character word searches in the query string.
The above word matching expression, unfortunately, will return any article that simply contains the letter "B". This does make sense. Searches for any other single character other than a "B" result in a pretty ugly error, but that's okay for now.
I've attempted to get the index to only accept <space>-"B"-<space> and <space>-"B"-<punct> with no success using the following word pattern matching expressions:
-k"\alnum{2,30}" -k"[\s][Bb]{1}[\s]" -k"[\s][Bb]{1}[\punct]"
This returns an ugly error message no matter what single character search is performed, including "B".
In all cases, I get the error message indicating that the "query would require a linear search". But first things first....
Being somewhat unfamiliar with regular expressions, I could be way off in left field on the word pattern matching expressions...or maybe not. Either way, any assistance you could provide in helping me solve this problem would be greatly appreciated!
Thanks in advance,
Aaron Drielick