Skip to content

Feature/7786 use double quote search#262

Merged
utas-raymondng merged 4 commits intomainfrom
feature/7786-use-double-quote-search
Apr 14, 2026
Merged

Feature/7786 use double quote search#262
utas-raymondng merged 4 commits intomainfrom
feature/7786-use-double-quote-search

Conversation

@shaunahu
Copy link
Copy Markdown
Contributor

@shaunahu shaunahu commented Apr 13, 2026

Currently, if we search with text, it executes a fuzzy match, so if search with ARGOS, argo comes as well. This is not expected according to user feedback:

Things that have ARGOS communication system (shelf drifters, gliders, seal-ctd, AUVs, moorings,….). ARGOS is not the same as Argo, and these instruments should not be grouped together.

image

So allow exact search with term if user type text with double quote:
image

Query:
[DEV] 2026-04-13 16:55:20 DEBUG ElasticSearchBase:373 - Elastic search payload for count CountRequest: POST /es-indexer-edge/_count {"query":{"script_score":{"query":{"bool":{"filter":[{"geo_bounding_box":{"summaries.proj:geometry":{"top_left":{"lat":-8.0,"lon":104.0},"bottom_right":{"lat":-43.0,"lon":163.0}}}}],"minimum_should_match":"1","must":[{"match_all":{}}],"should":[{"match_phrase":{"title":{"query":"ARGOS"}}},{"match_phrase":{"description":{"query":"ARGOS"}}}]}},"script":{"source":"double internalScore = doc.containsKey('summaries.score') && !doc['summaries.score'].empty ? doc['summaries.score'].value : 0.0; double normalizedScore = internalScore / 106.0; double multiplier = Math.max(normalizedScore, 0.01); return _score * multiplier;","lang":"painless"}}}}

[DEV] 2026-04-14 10:21:35 DEBUG ElasticSearchBase:373 - Elastic search payload for count CountRequest: POST /es-indexer-edge/_count {"query":{"script_score":{"query":{"bool":{"filter":[{"geo_bounding_box":{"summaries.proj:geometry":{"top_left":{"lat":-8.0,"lon":104.0},"bottom_right":{"lat":-43.0,"lon":163.0}}}}],"minimum_should_match":"1","must":[{"match_all":{}}],"should":[{"match_phrase":{"title":{"query":"ARGOS"}}},{"match_phrase":{"description":{"query":"ARGOS"}}},{"match_phrase":{"summaries.parameter_vocabs":{"query":"ARGOS"}}},{"match_phrase":{"summaries.organisation_vocabs":{"query":"ARGOS"}}},{"match_phrase":{"summaries.platform_vocabs":{"query":"ARGOS"}}},{"match_phrase":{"id":{"boost":100.0,"query":"ARGOS"}}},{"nested":{"path":"links","query":{"match":{"links.title":{"query":"ARGOS"}}}}},{"match":{"summaries.credits":{"query":"ARGOS"}}}]}},"script":{"source":"double internalScore = doc.containsKey('summaries.score') && !doc['summaries.score'].empty ? doc['summaries.score'].value : 0.0; double normalizedScore = internalScore / 106.0; double multiplier = Math.max(normalizedScore, 0.01); return _score * multiplier;","lang":"painless"}}}}

@shaunahu shaunahu marked this pull request as ready for review April 13, 2026 06:56
Copy link
Copy Markdown
Collaborator

@utas-raymondng utas-raymondng left a comment

Choose a reason for hiding this comment

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

Clarify logic

should.add(CQLFields.description.getPropertyEqualToQuery(term)); // match term in original description text
}
else {
should.add(CQLFields.fuzzy_title.getPropertyEqualToQuery(t));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is that we just need to handle title and description only, the other field keep it as is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In this query, it equals:

"should":[{"match_phrase":{"title":{"query":"ARGOS"}}},{"match_phrase":{"description":{"query":"ARGOS"}}}]

So it only handle title and description with no fuzzy match. Do you think we should also include the other fields (like parameter_vocabs, id, etc.) in the exact match search?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suspect it is only the fuzzy that causing problem

Copy link
Copy Markdown
Collaborator

@utas-raymondng utas-raymondng left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Collaborator

@utas-raymondng utas-raymondng left a comment

Choose a reason for hiding this comment

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

LGTM

@utas-raymondng utas-raymondng merged commit a9bd6dc into main Apr 14, 2026
4 checks passed
@utas-raymondng utas-raymondng deleted the feature/7786-use-double-quote-search branch April 14, 2026 00:51
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