feat: support & as AND operator in search - #96
Open
legentpc wants to merge 1 commit into
Open
Conversation
j10a1n15
requested changes
Aug 24, 2026
j10a1n15
left a comment
Collaborator
There was a problem hiding this comment.
The pr title doesnt match the sh template
Comment on lines
39
to
+40
| '|'.code -> style = style.withColor(CommonColors.SOFT_YELLOW) | ||
| '&'.code -> style = style.withColor(CommonColors.SOFT_YELLOW) |
Collaborator
There was a problem hiding this comment.
Suggested change
| '|'.code -> style = style.withColor(CommonColors.SOFT_YELLOW) | |
| '&'.code -> style = style.withColor(CommonColors.SOFT_YELLOW) | |
| '|'.code, '&'.code -> style = style.withColor(CommonColors.SOFT_YELLOW) |
Comment on lines
+20
to
+25
| aFilter.forEachIndexed { index, aGroup -> | ||
| val bGroup = bFilter[index] | ||
| if (bGroup.size != aGroup.size) return true | ||
| aGroup.forEachIndexed { i, aSearch -> | ||
| if (!bGroup[i].startsWith(aSearch)) return true | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| aFilter.forEachIndexed { index, aGroup -> | |
| val bGroup = bFilter[index] | |
| if (bGroup.size != aGroup.size) return true | |
| aGroup.forEachIndexed { i, aSearch -> | |
| if (!bGroup[i].startsWith(aSearch)) return true | |
| } | |
| aFilter.forEachIndexed { filterIndex, aGroup -> | |
| val bGroup = bFilter[filterIndex] | |
| if (bGroup.size != aGroup.size) return true | |
| aGroup.forEachIndexed { groupIndex, aSearch -> | |
| if (!bGroup[groupIndex].startsWith(aSearch)) return true | |
| } |
Open
j10a1n15
requested changes
Aug 24, 2026
Collaborator
There was a problem hiding this comment.
Also consider adding something similar to this instead of the List<List>, we aren't really in favour of this
The Code
interface Search {
fun matches(stackName: String, loreLines: List<String>): Boolean
}
data class TermSearch(val term: String) : Search {
override fun matches(stackName: String, loreLines: List<String>): Boolean {
return stackName.contains(term) || loreLines.any { line -> line.contains(term) }
}
}
data class AndSearch(val conditions: List<Search>) : Search {
override fun matches(stackName: String, loreLines: List<String>): Boolean {
return conditions.all { condition -> condition.matches(stackName, loreLines) }
}
}
data class OrSearch(val conditions: List<Search>) : Search {
override fun matches(stackName: String, loreLines: List<String>): Boolean {
return conditions.any { condition -> condition.matches(stackName, loreLines) }
}
}Or take the code from this unmerged branch: master...feat/search-improvements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Added
&to search. Terms joined with|match items containing any of them (unchanged),While terms joined with
&match only items that contain all of them. Example:Hecatomb X & Last Stand Vhighlights only the item that has both names. Works in the item list and in the container search (double-click on the search bar).Changelog New Features
&operator to search, which only matches items that contain all searched terms.Hecatomb X & Last Stand Vhighlights only the item that has both names; works in the item list and container search (double-click).|:a & b | cmeans (a AND b) OR c.Changelog Technical Details
|) of AND terms (&) and matched as OR-of-ANDs.isDistinctSearchcompares the group structure, so changing an operator mid-search re-filters from the full list.&is highlighted in the search bar, just like|.