Skip to content

Show context info for duplicate labels in vocab search autocomplete results - #2135

Open
joelit wants to merge 11 commits into
mainfrom
issue1888-search-result-context-info
Open

joelit wants to merge 11 commits into
mainfrom
issue1888-search-result-context-info

Conversation

@joelit

@joelit joelit commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Reasons for creating this PR

This PR repearts the functionality that was done in Skosmos 2 in PR #1380 (credit @kouralex ), as implementing this in Skosmos 3 has been requested.

Link to relevant issue(s), if any

Description of the changes in this PR

When a vocabulary is configured to distinguish between duplicate labels, Skosmos will display the context information in autocomplete search results.

Example configuration would be something like this for the vocabulary object in config.ttl:
skosmos:resultDistinguisher "<http://www.w3.org/2004/02/skos/core#broader>|<http://purl.org/dc/terms/source>";

Known problems or uncertainties in this PR

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

Disclosure of AI Tool Usage

  • 🟢 AI:GREEN
    • AI-assisted. Author drove the process, AI used as a tool (autocomplete, partial generation, refactoring help).

Describe the AI tool(s) you used:

  • TermMate with OpenAI Codex (GPT-6)

@joelit joelit self-assigned this Nov 11, 2026
@joelit
joelit requested a review from osma November 11, 2026 14:15
@joelit joelit moved this to Under review in Skosmos 3.x Backlog Nov 11, 2026
@joelit joelit moved this from Under review to In progress in Skosmos 3.x Backlog Nov 11, 2026
@joelit joelit added this to the 3.6 milestone Nov 11, 2026
@qltysh

qltysh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

All good ✅

Comment thread src/model/sparql/GenericSparql.php Resolved
Comment thread src/model/sparql/GenericSparql.php Resolved
@joelit joelit moved this from In progress to Under review in Skosmos 3.x Backlog Nov 11, 2026

@osma osma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tested this briefly. It works pretty well already!

The CSS needs some adjustment as the left margin is not properly aligned (on Firefox):

image

Also, tests are missing.

Comment thread resource/css/skosmos.css Outdated
outline: none !important;
box-shadow: inset 0 0 0 3px var(--focus-color) !important;
}
.autocomplete-result a .row + .row {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if this is the best way to set the margin. Maybe you could give a custom CSS class (e.g. class="result-distinguisher" to the div and then style it via that class?

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.63%. Comparing base (d9ff731) to head (963ca97).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
src/model/sparql/GenericSparql.php 96.15% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2135      +/-   ##
============================================
- Coverage     70.99%   70.63%   -0.37%     
- Complexity     1723     1730       +7     
============================================
  Files            34       34              
  Lines          4479     4560      +81     
============================================
+ Hits           3180     3221      +41     
- Misses         1299     1339      +40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joelit

joelit commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

I tested this briefly. It works pretty well already!

The CSS needs some adjustment as the left margin is not properly aligned (on Firefox):

The indentation of the distinguisher information is intentional, as it creates a visual hierarchy between the search results and the additional context information. Skosmos 2.18 used to line the text on the same vertical alignment, but with different font sizes, 14px and 12px (0.88 and 0.75 rem). I'll ask around for opinions, while I write the tests for API and front end. I agree, giving the context information styling via class designation is a better CSS structure.

@joelit
joelit marked this pull request as ready for review November 12, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Under review

Development

Successfully merging this pull request may close these issues.

Vocabulary Search Bar: Display additional information for each search result (according to configuration)

2 participants