hypothesis / hypothesis/product-backlog

Searching for a tag w/ spaces does not behave as expected

Open
#906 0 comments 0 reactions 0 assignees View on GitHub
Elasticsearch
Dominant language
No language data
Stars
122
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Currently when searching for a tag such as "human intelligence", analysis is performed on the query internally inside elasticsearch before it is searched for. This analysis breaks up the tag "human intelligence" into "human" and "intelligence" which results in an unexpected broadening of the search. So while the expected behavior would be to find all annotations that have the exact tag "human intelligence", what actually happens is all annotations whose tags contain the words "human" and "intelligence" are returned. Even if for example an annotation contains tags "human intervention" "artificial intelligence".

To fix this, the query filter for tags should be modified to something like:
```
"query": {
"term": {
"tags_raw": "human intelligence"
}
}
```
See https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html for details.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Elasticsearch tag query and review the issue's tags_raw term-query example alongside the linked Elasticsearch term query documentation. Done means searching for a tag such as "human intelligence" returns annotations with that exact tag, without matching separate tags containing "human" and "intelligence".

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.