-
-
Notifications
You must be signed in to change notification settings - Fork 398
core/lib search results must be the same as from the IDE 1.x #1895
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
Comments
Another alternative solution could be if IDE2 converted the |
for reference here's how the Arduino IDE 1.8.x do the search, I'm going to implement the same search: private boolean filterCondition(ContributedLibraryReleases lib) {
if (selectedCategoryFilter != null && !selectedCategoryFilter.test(lib)) {
return false;
}
ContributedLibrary latest = lib.getLatest();
String compoundTargetSearchText = latest.getName() + " "
+ latest.getParagraph() + " "
+ latest.getSentence();
if (latest.getProvidesIncludes() != null) {
compoundTargetSearchText += " " + latest.getProvidesIncludes();
}
if (!stringContainsAll(compoundTargetSearchText, selectedFilters)) {
return false;
}
return true;
}
/**
* Check if <b>string</b> contains all the substrings in <b>set</b>. The
* compare is case insensitive.
*
* @param string
* @param filters
* @return <b>true<b> if all the strings in <b>set</b> are contained in
* <b>string</b>.
*/
private boolean stringContainsAll(String string, String filters[]) {
if (string == null) {
return false;
}
if (filters == null) {
return true;
}
for (String filter : filters) {
if (!string.toLowerCase().contains(filter.toLowerCase())) {
return false;
}
}
return true;
} |
Thank you for taking care of it! Where is the |
Very good point... mmmmmmm |
ok I think I found it: public void applyFilter() {
String[] filteredText = new String[0];
if (!showingHint) {
String filter = getText().toLowerCase();
// Replace anything but 0-9, a-z, or : with a space
filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a^\\x3a]", " ");
filteredText = filter.split(" ");
}
onFilter(filteredText);
} so in the query we must |
Describe the problem
There is an inconsistency between the CLI
lib search
output and IDE 1.x's Library Manager functionality.The issue originally popped up here: arduino/arduino-ide#1442
IDE2 wants to produce the same library search results as IDE 1.x. When searching for the
SparkFun_u-blox_GNSS
term, the following results should be returned by the CLI:The CLI returns with one result only, where the
name
matches:./arduino-cli lib search "SparkFun_u-blox_GNSS" --format json
:To reproduce
Compare the library search output of the CLI and the Arduino IDE 1.x. See the description for more details.
Expected behavior
The same lib/core search result is produced by the CLI and IDE 1.x.
Arduino CLI version
arduino-cli Version: 0.27.1 Commit: a900cfb Date: 2022-09-06T16:44:27Z
Operating system
macOS
Operating system version
12.5.1
Additional context
No response
Issue checklist
The text was updated successfully, but these errors were encountered: