Commit 21938926 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in proximity searches.

parent 074cc8a8
...@@ -30,7 +30,7 @@ Example usage: ...@@ -30,7 +30,7 @@ Example usage:
print i['blah'] print i['blah']
$Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $''' $Id: InvertedIndex.py,v 1.30 1997/04/14 12:03:17 jim Exp $'''
# Copyright # Copyright
# #
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne # Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...@@ -82,6 +82,9 @@ $Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $''' ...@@ -82,6 +82,9 @@ $Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $'''
# (540) 371-6909 # (540) 371-6909
# #
# $Log: InvertedIndex.py,v $ # $Log: InvertedIndex.py,v $
# Revision 1.30 1997/04/14 12:03:17 jim
# Fixed bug in proximity searches.
#
# Revision 1.29 1997/04/08 00:14:22 jim # Revision 1.29 1997/04/08 00:14:22 jim
# Chris' changes, I think.... # Chris' changes, I think....
# #
...@@ -184,7 +187,7 @@ $Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $''' ...@@ -184,7 +187,7 @@ $Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $'''
# #
# #
# #
__version__='$Revision: 1.29 $'[11:-2] __version__='$Revision: 1.30 $'[11:-2]
import regex, regsub, string, copy import regex, regsub, string, copy
...@@ -289,7 +292,7 @@ class ResultList: ...@@ -289,7 +292,7 @@ class ResultList:
return result return result
def and_not(self, x): def and_not(self, x):
'''Return items in the reciever that are not in the argument''' '''Return items in the receiver that are not in the argument'''
result = self.__class__() result = self.__class__()
...@@ -374,6 +377,8 @@ class ResultList: ...@@ -374,6 +377,8 @@ class ResultList:
if value is None: if value is None:
continue continue
score=pow(v[0]*value[0],0.5)
positions = v[1] + value[1] positions = v[1] + value[1]
positions.sort() positions.sort()
positionsr = [] positionsr = []
...@@ -392,7 +397,7 @@ class ResultList: ...@@ -392,7 +397,7 @@ class ResultList:
pl = p pl = p
if (len(positionsr)): if (len(positionsr)):
result[key] = positionsr result[key] = score,positionsr
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment