Skip to content

Commit

Permalink
Fixes to slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaredoug committed May 11, 2024
1 parent 39d1a30 commit 5ef7a2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion searcharray/phrase/middle_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ def phrase_freqs(self, term_ids: List[int],
keys=keys,
min_payload=min_posn,
max_payload=max_posn) for term_id in term_ids]
import pdb; pdb.set_trace()

if slop == 0:
return compute_phrase_freqs(enc_term_posns, phrase_freqs, max_doc_id=np.uint64(self.max_doc_id))
Expand Down
1 change: 0 additions & 1 deletion searcharray/postings.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,6 @@ def phrase_freq(self, tokens: List[str],
doc_ids = self.term_mat.rows

term_ids = [self.term_dict.get_term_id(token) for token in tokens]
import pdb; pdb.set_trace()
phrase_freqs = self.posns.phrase_freqs(term_ids,
doc_ids=doc_ids,
slop=slop,
Expand Down
5 changes: 3 additions & 2 deletions searcharray/roaringish/snp_ops.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ cdef void _gallop_intersect_keep(DTYPE_t* lhs,
DTYPE_t* rhs_out,
DTYPE_t* lhs_out_len,
DTYPE_t* rhs_out_len,
DTYPE_t mask=ALL_BITS) noexcept nogil:
DTYPE_t mask=ALL_BITS) noexcept:
"""Two pointer approach to find the intersection of two sorted arrays."""
cdef DTYPE_t* lhs_ptr = &lhs[0]
cdef DTYPE_t* rhs_ptr = &rhs[0]
Expand All @@ -275,7 +275,7 @@ cdef void _gallop_intersect_keep(DTYPE_t* lhs,
cdef DTYPE_t* lhs_result_ptr = &lhs_out[0]
cdef DTYPE_t* rhs_result_ptr = &rhs_out[0]

while lhs_ptr < end_lhs_ptr or rhs_ptr < end_rhs_ptr:
while lhs_ptr < end_lhs_ptr and rhs_ptr < end_rhs_ptr:
# Gallop past the current element
while lhs_ptr < end_lhs_ptr and (lhs_ptr[0] & mask) < (rhs_ptr[0] & mask):
lhs_ptr += (delta * lhs_stride)
Expand All @@ -288,6 +288,7 @@ cdef void _gallop_intersect_keep(DTYPE_t* lhs,
rhs_ptr -= ((delta >> 1) * rhs_stride)
delta = 1


# Now that we've reset, we just do the naive 2-ptr check
# Then next loop we pickup on exponential search
if (lhs_ptr[0] & mask) < (rhs_ptr[0] & mask):
Expand Down

0 comments on commit 5ef7a2b

Please sign in to comment.