Boolean Search

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Meade

    Boolean Search

    Hi all,

    Before I embark on a quest to improve our site search I was wondering if
    anyone knew of any good articles or has any advice on how to achieve what I
    want.

    I want to be able to allow the user to add a + or - before the words in the
    search criteria (like Google) to specify words that must or must not be in
    the results.

    The way I am contemplating doing this at the moment would be it take the
    search criteria and split it into an array by the space character, then
    iterate through that and create two separate arrays, one containing all of
    the words that have a + and one that contains all the words that contain
    a -.

    I would then construct a sql query using the first array and then at the end
    a criteria using NOT = and then the words in the second array.

    Does this sound like a plan?

    If so, how would I get around an exact phrase search, whereby the user may
    enter ".net for dummies" -2.0

    If I used the above approach I would have now split the criteria by the
    space character and lost the ability to use the "'s....

    That would suggest that I would need to split the search criteria by the
    quotes in the first place, but if I do that I'd end up with 2 strings, one
    would equal .net for dummies and the other would equal -2.0 , and I'd have
    no idea which contained the exact phrase...especi ally when a user might do
    something like this:

    +piggy "charlottes web" -farm

    Can anyone help me out with this?

    My project is seaching index server, so far its working well and has a very
    pleasing output, I now want to add additional functionality/support to it.

    Thanks in advance,

    Regards

    Rob



Working...