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

Facet result for suggestion #835

Open
wants to merge 11 commits into
base: dtq-dev
Choose a base branch
from
Open

Conversation

Paurikova2
Copy link
Collaborator

@Paurikova2 Paurikova2 commented Dec 20, 2024

Phases MP MM MB MR JM Total
ETA 0 0 0 0 0 0
Developing 2 0 0 0 0 0
Review 0 0 0 0 0 0
Total - - - - - 0
ETA est. 0
ETA cust. - - - - - 0

Problem description

Replace IndexObject by Facet.
image
Test link: http://localhost:8080/server/api/core/metadatavalues/search/byValue?schema=dc&element=title&searchValue=tes

Copy link
Collaborator

@milanmajchrak milanmajchrak left a comment

Choose a reason for hiding this comment

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

Make it NO-case-sensitive

Comment on lines +263 to +273
searchResult.getFacetResult(autocompleteCustom).forEach(facetResult -> {
String displayedValue = facetResult.getDisplayedValue();
if (displayedValue.contains(searchValue)) {
// Create a new VocabularyEntryRest object
VocabularyEntryRest vocabularyEntryRest = new VocabularyEntryRest();
// All values from Item's specific index - it could contain values we are not looking for.
// The must be filtered out.
List<String> docValues = searchDocument.getSearchFieldValues(autocompleteCustom);

// Filter values that contain searchValue
List<String> filteredValues = docValues.stream()
.filter(value -> value.contains(searchValue))
.collect(Collectors.toList());

// Add filtered values to the results. It contains only values that contain searchValue.
filteredValues.forEach(value -> {
vocabularyEntryRest.setDisplay(value);
vocabularyEntryRest.setValue(value);
results.add(vocabularyEntryRest);
});
});
vocabularyEntryRest.setDisplay(displayedValue);
vocabularyEntryRest.setValue(displayedValue);

// Add the filtered value to the results
results.add(vocabularyEntryRest);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do this also in the MetadataValueRestRepository

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We cannot use facet here because there is no metadata solar search index for it. But I modified search that for now we get all results, no only the first ten results.

@Paurikova2
Copy link
Collaborator Author

@milanmajchrak
The Solr search is case-sensitive. If we want to make it case-insensitive, we need to add a new custom field type that applies a lowercasing filter (https://dev.to/cendekia/perform-case-insensitive-sorting-in-solr-6k4). However, because we don't want to modify the Solr schema and because we don't want to spend time on unnecessary work, I believe that adopting a case-insensitive approach is not necessary for now.

@@ -231,11 +231,14 @@ public <E extends ReloadableEntity> E reloadEntity(final E entity) throws SQLExc
log.info("reloadEntity() - Entity is null - return null");
return null;
} else if (getSession().contains(entity)) {
log.info("reloadEntity() - Entity is in the session - return entity with ID {}", entity.getID());
log.info("reloadEntity() - Entity is in the session - return entity with ID {}",
entity.getID());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is because of the incorrect check style from dtg-dev branch

log.info("reloadEntity() - Entity is not in the session - return entity with ID {}",
entity.getID());
return (E) getSession().get(HibernateProxyHelper.getClassWithoutInitializingProxy(entity),
entity.getID());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is because of the incorrect check style from dtg-dev branch

Integer.MAX_VALUE : (int) totalResultsLong;
// Perform the search again, this time retrieving the actual results based on the total count
searchResult = createAndRunDiscoverResult(context, metadataField, searchValue, totalResults);
for (IndexableObject object : searchResult.getIndexableObjects()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

from 124 to 154 is original code, no changes

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.

UFAL/Suggestion Controller - fetch values from facet results instead of indexable object
2 participants