Page 1 of 2

lude results from an URL

Posted: Mon Aug 30, 2004 6:05 pm
by KMandalia
What should I type in the search box,if I want to exclude all results from a particular website?

lude results from an URL

Posted: Tue Aug 31, 2004 10:26 am
by mark
The search script doesn't do that as is. One way you could do it would be to change it slightly to repurpose the uq variable. Change
and Url matches $$suq
to
and Url not matches $$suq
Then provide an extra box on the search form to enter urls to exclude such as http://www.someplace.com%

lude results from an URL

Posted: Tue Aug 31, 2004 12:04 pm
by KMandalia
what I meant was, is there any REX expression or way that users can type in the search box to exclude that url, like 'search term1 term2.. somerex someurl.ext'

lude results from an URL

Posted: Tue Aug 31, 2004 12:51 pm
by mark
The search script doesn't do that as is. If you added Url to the search index, by modifying dowalk and search scripts, a user could say
term1 term2 -somesite
to exclude any records at or mentioning somesite. Or you could invent a new syntax to exclude by just url. Modify fpar to extract the new syntax and turn it into a value for $uq.

lude results from an URL

Posted: Tue Aug 31, 2004 4:11 pm
by KMandalia
Thanks.

I have decided to force users to enter their URL like www.somesite.com.

Now I just have to stick http:// in front of whatever is in the text box. I will do this in fpar and assign it to $uq. Then I just have to change

and Url matches $$uq

to

and Url not maches $$uq

Am I right all the way?

BTW, what is the value of $uq, I don't see it get assigned any value in the search script.

lude results from an URL

Posted: Tue Aug 31, 2004 4:58 pm
by mark
Sounds mostly ok. Might be a little hard to extract from query without some kind of tag in front. Maybe something like "nosite:www.somesite.com". Then you can key off the "nosite:".

$uq is not used by default. It's in there for use in situations like this. The code for handling it's all in there. You just have to decide how you want to set it.

lude results from an URL

Posted: Tue Aug 31, 2004 5:04 pm
by KMandalia
I am using a separate text box for entering urls. It is named excludeurl.

I then do the following in the search function:

<IF $excludeurl neq "">
<sum "%s" "http://" $excludeurl>
<$uq=$ret>
<$excludeurl=>
</IF>

and then

Url not maches $$uq


Doesn't work, what am I forgetting?

lude results from an URL

Posted: Tue Aug 31, 2004 6:06 pm
by mark
You need to append % to the end of the uq as well
<sum "%s" "http://" $excludeurl "%">

Also try viewing the source of the results page to see if there are warning or errors in html comments.

lude results from an URL

Posted: Wed Sep 01, 2004 8:34 am
by KMandalia
Yup, it works now. Thank you.

Continuing along the line, could you tell me how can I tweak it so that,I can tell users that in the exclude url box if you put something like keep:www.somesite.com then instead of excluding somesite only that site will be searched.

1) How do I separate the value keep: and www.somesite.com

2) I then just need to put if/else around the sql that has Url not matches $$uq, right?

lude results from an URL

Posted: Wed Sep 01, 2004 12:14 pm
by mark
<rex ">>keep:\P=[^\space]+" $uq><$keep=$ret>
<sandr ">>keep:\P=[^\space]+" "" $uq><$uq=$ret>

You could replicate the sql, one for matches and one for not matches and choose with an if as you suggest. Or you can make it generic by creating a new query variable such as "$kq" for example. Go through the script finding where uq is processed. Do the same for kq. Then in the sql have
...
and Url matches $kq
and Url not matches $uq
...
sql will automatically ignore those clauses if the query variable is unset.