Boolean Search

R

Rob Meade

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...especially 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top