David Brown wrote on 2/5/10 4:34 PM:
> Peter,
>
> I think it could be your expectations, presuming that not has high
> precedence and we can look at it as Boolean / set logic.
>
> ~foo ^ ~bar ==> intersection of all items that are not foo with all items
> that are not bar
> ~ (foo ^ bar) ==> complement (not) of all items that are both (intersection
> of) foo and bar
>
>
> Truth table:
> foo | bar | ~foo^~bar | ~(foo ^ bar)
> ----+-----+-----------+---------------
> T | T | F | F
> T | F | F | T
> F | T | F | T
> F | F | T | T
>
> Would that thinking actually carry through to swish-e? I did review
> http://swish-e.org/docs/swish-search.html before posting, but it tries to be
> helpful rather than theoretical :)
>
Thanks, Dave. That was a useful thought exercise.
My reading of search.c in the parseterm() function suggests that "not" does have
high precedence.
Then I did this simple test case to prove it. I believe it bears out your truth
table above, and that my expectations were indeed wrong.
[karpet@pekmac:~/tmp/query-test]$ cat test.html
<html>
<head>
<title>doc one</title>
</head>
<body>
foo bar
</body>
</html>
[karpet@pekmac:~/tmp/query-test]$ cat test2.html
<html>
<head>
<title>doc two</title>
</head>
<body>
foo bar
</body>
</html>
[karpet@pekmac:~/tmp/query-test]$ cat test3.html
<html>
<head>
<title>doc three</title>
</head>
<body>
hello world
</body>
</html>
[karpet@pekmac:~/tmp/query-test]$ cat test4.html
<html>
<head>
<title>doc four</title>
</head>
<body>
foo green
</body>
</html>
[karpet@pekmac:~/tmp/query-test]$ swish-e -v0 -i *html
[karpet@pekmac:~/tmp/query-test]$ swish-e -w 'not (foo bar)' -H0
1000 test4.html "doc four" 88
1000 test3.html "doc three" 91
[karpet@pekmac:~/tmp/query-test]$ swish-e -w '(not foo not bar)' -H0
1000 test3.html "doc three" 91
.
--
Peter Karman . http://peknet.com/ . peter(at)not-real.peknet.com
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Sun Feb 7 21:44:33 2010