Code Monkey home page Code Monkey logo

montezuma's People

Contributors

kraison avatar reanz59 avatar xach avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

montezuma's Issues

EOF condition raised when calling (get-document <index> <big-number>)

Hi

I struck an EOF condition when calling get-document. This code from my src/index/fields-io.lisp
improves the user experience but it should probably report the error to standard-output.

It's easy enough to get the problem condition. Here's the modified code with a handler-case.

(defmethod get-document ((self fields-reader) n)
(handler-case
(with-slots (index-stream fields-stream field-infos) self
(seek index-stream (* n 8))
(let ((position (read-long index-stream)))
(seek fields-stream position))
(let ((doc (make-instance 'document)))
(let ((num-fields (read-vint fields-stream)))
(dotimes (i num-fields)
(let* ((field-number (read-vint fields-stream))
(fi (get-field field-infos field-number))
(bits (read-byte-from-buffer fields-stream)))
(let ((compressed (logbitp +field-is-compressed-bit+ bits))
(tokenize (logbitp +field-is-tokenized-bit+ bits))
(binary (logbitp +field-is-binary-bit+ bits)))
(if binary
(let ((b (make-array (read-vint fields-stream))))
(read-bytes-from-buffer fields-stream b 0 (length b))
(if compressed
(add-field doc
(make-binary-field (field-name fi)
(uncompress b)
:compress))
(add-field doc (make-binary-field (field-name fi) b T))))
(let ((store T)
(index (if (field-indexed-p fi)
(if tokenize
:tokenized
(if (field-omit-norms-p fi)
:no-norms
:untokenized))
NIL))
(data nil))
(if compressed
(progn
(setf store :compress)
(let ((b (make-array (read-vint fields-stream))))
(read-bytes-from-buffer fields-stream b 0 (length b))
(setf data (bytes-to-string (uncompress b)))))
(setf data (read-string fields-stream)))
(let ((stv (if (field-store-term-vector-p fi)
(cond ((and (field-store-positions-p fi)
(field-store-offsets-p fi))
:with-positions-offsets)
((field-store-positions-p fi) :with-positions)
((field-store-offsets-p fi) :with-offsets)
(T T))
NIL)))
(add-field doc (make-field (field-name fi) data
:stored store
:index index
:store-term-vector stv)))))))))
doc))
(error (condition)
nil)))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.