lude results from an URL

KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

lude results from an URL

Post by KMandalia »

Thanks mark,

1) How to enter multiple URLs to exclude?

2) How to specify multiple URLs to include?

Why is the ^\space?

I did the rex first, then based on the value of keep (empty or not) I would do sandr and set a flag and use that flag to exclude/only show that URL. exclude works fine,but when I want to only keep somesite.com and enter keep:www.somesite.com it doesn't work?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

lude results from an URL

Post by mark »

I used ^\space so that any whitespace would be the delimiter between terms.

Did you translate $keep into a useful value for $kq?

For multiples you can take either of 2 approaches. You can build up the SQL statement dynamically so it ends up looking like
and (Url matches 'val1' or Url matches 'val2')
and (Url not matches 'val3' and Url not matches 'val3')
Ensure that the users' typed value doesn't include any quotes (') with <sandr>.
Or you can switch to "like" instead of matches. Construct $kq and $uq to look like
val1 val2 @0
and use SQL
and Url like $kq
and Url not like $uq
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

lude results from an URL

Post by KMandalia »

I am definately not following you. I do understand what we are trying to do and the logic but it doesn't work in case of keep:www.somesite.com.

This is what I did based on my understanding of rex and sandr and with your help,

The name of the textbox is excludeurl.

<$keepurl=1> (default)
<if excludeurl neq ""> (If Something in the textbox)
<rex ">>keep:\P=[^\space]+" $excludeurl><$keep=$ret>
(The value in $keep would be keep:, Right?)
<if $keep neq "">
<sandr ">>keep:\P=[^\space]+" "" $excludeurl>This line takes out keep: and puts www.somesite.com in $ret, Right?)
<sum "%s" "http://" $ret "%">
<$uq=$ret> <$keepurl=1> (My flag to know I have to keep only this url)
<else>
<$keepurl=0>
<sum "%s" "http://" $excludeurl "%">
<$uq=$ret>
</if>
</if>

by doing keep:www.somesite.com, I want to show results from ONLY that site. I know the term is a bit misleading.

And then the sql statement would be like,
<if keepurl=0>
<$sql="from html
where Title\Description\Keywords\Meta\Body " $liketype " $$q
and Title like $$tq
and Url not matches $$uq
and Depth <= $$dq
and Catno matches $$cq
">
<else>
<$sql="from html
where Title\Description\Keywords\Meta\Body " $liketype " $$q
and Title like $$tq
and Url matches $$uq
and Depth <= $$dq
and Catno matches $$cq
">
</if>
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

lude results from an URL

Post by mark »

No. The rex extracts the hostname you need. The sandr removes the whole keep:hostname from the query (except that I left the \P in my sandr example which should not be there).
<$q="keep:www.mysite.com">
<rex ">>keep:\P=[^\space]+" $q><$keep=$ret>
<sandr ">>keep:=[^\space]+" "" $q><$q=$ret>
<sum "%s" "http://" $keep "%"><$uq=$ret>
You don't need a keepurl flag. The non-empty uq tells you that.

In your first if you left the $ off of excludeurl.

If there are multiple "keep:"'s it gets more complicated. You need to loop over the results and build things up.
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

lude results from an URL

Post by KMandalia »

I wanted to do it the exactly the way I described above. See my comments. I want to figure out if there is a keep: in the text box and if yes, take only keep: out and set a flag. Rather trivial way and I would build logic up step by step. Don't need multiple urls for the time being and don't care if users make mistake in entering. If they do then it wouldn't work.

I think I can use substr and split to get it done, could you give me the syntax for that?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

lude results from an URL

Post by mark »

<rex ">>keep:\P=[^\space]+" $excludeurl>
<$keep=$ret>
<if $keep eq "">
<$keepurl=0>
<sum "%s" "http://" $excludeurl "%">
<$uq=$ret>
<else>
<$keepurl=1>
<sum "%s" "http://" $keep "%">
<$uq=$ret>
</if>
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

lude results from an URL

Post by KMandalia »

many many thanks, Mark. It now works fine.
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

lude results from an URL

Post by KMandalia »

http://search.creditunions.com

search for 'patelco'and notice 3 results from creditunions.com at the top.

Now, go to 'Advanced Search' and enter 'patelco' in search box and enter 'www.patelco.org' in base url. The three results from Creditunions.com block is not appearing now. It is happening everytime I use the exclude url box.

Any thoughts on what I am doing wrong? Let me know if you need more details.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

lude results from an URL

Post by mark »

Dunno. What sql did you wind up using there? What's the value of the variables being compared?
Post Reply