Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error checking when attempting to fetch doc vector of non-existent document #1208

Merged
merged 2 commits into from
May 18, 2020

Conversation

lintool
Copy link
Member

@lintool lintool commented May 17, 2020

Cf. #1207

@lintool lintool requested a review from x65han May 17, 2020 20:41
@codecov
Copy link

codecov bot commented May 17, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@ca231bb). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1208   +/-   ##
=========================================
  Coverage          ?   48.27%           
  Complexity        ?      735           
=========================================
  Files             ?      147           
  Lines             ?     8537           
  Branches          ?     1212           
=========================================
  Hits              ?     4121           
  Misses            ?     4077           
  Partials          ?      339           
Impacted Files Coverage Δ Complexity Δ
.../main/java/io/anserini/index/IndexReaderUtils.java 50.93% <100.00%> (ø) 29.00 <3.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca231bb...89f26f4. Read the comment docs.

Copy link
Member

@x65han x65han left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* @throws IOException if error encountered during query
* @throws NotStoredException if the term vector is not stored
*/
public static Map<String, Long> getDocumentVector(IndexReader reader, String docid) throws IOException, NotStoredException {
Terms terms = reader.getTermVector(convertDocidToLuceneDocid(reader, docid), IndexArgs.CONTENTS);
int ldocid = convertDocidToLuceneDocid(reader, docid);
if (ldocid == -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@lintool lintool merged commit 33b0684 into master May 18, 2020
@lintool lintool deleted the error-check branch May 18, 2020 00:50
crystina-z pushed a commit to crystina-z/anserini that referenced this pull request Oct 28, 2022
Recently changed config for field indexing in Anserini, propagating changes to Pyserini.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants