Skip to content

Commit

Permalink
Merge pull request #33 from vespa-engine/tgm/collect-zero-extra
Browse files Browse the repository at this point in the history
only get additional more hits if > 0
  • Loading branch information
Thiago G. Martins committed Oct 22, 2020
2 parents 8dc0331 + 92d04a1 commit 977785d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vespa/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,14 @@ def collect_training_data_point(
hits = relevant_id_result.hits
features = []
if len(hits) == 1 and hits[0]["fields"][id_field] == relevant_id:
random_hits_result = self.query(
query=query,
query_model=query_model,
hits=number_additional_docs,
**kwargs
)
hits.extend(random_hits_result.hits)
if number_additional_docs > 0:
random_hits_result = self.query(
query=query,
query_model=query_model,
hits=number_additional_docs,
**kwargs
)
hits.extend(random_hits_result.hits)

features = self.annotate_data(
hits=hits,
Expand Down

0 comments on commit 977785d

Please sign in to comment.