wordpress-mobile / wordpress-mobile/WordPress-iOS
StringRankedSearch inconsistent results when numbers and letters are mixed
Open
Nobody has claimed this yet.
[Type] Enhancement
General
- Dominant language
- Swift
- Stars
- 3.9k
- Forks
- 1.2k
- Avg merge
- 23h 51m
- Merged PRs (30d)
- 58
Description
Demonstrated by the following unit tests (originally reported here https://github.com/wordpress-mobile/WordPress-iOS/pull/23776/):
func testSearchBeginingOrEnd() {
XCTAssertEqual(score("AB00", "AB"), score("ABXX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("4200", "42"), score("42XX", "42"), accuracy: 0.1)
XCTAssertEqual(score("00AB", "AB"), score("XXAB", "AB"), accuracy: 0.1)
XCTAssertEqual(score("0042", "42"), score("XX42", "42"), accuracy: 0.1)
XCTAssertEqual(score("AB_00", "AB"), score("AB_XX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("42_00", "42"), score("42_XX", "42"), accuracy: 0.1)
XCTAssertEqual(score("00_AB", "AB"), score("XX_AB", "AB"), accuracy: 0.1)
XCTAssertEqual(score("00_42", "42"), score("XX_42", "42"), accuracy: 0.1)
XCTAssertEqual(score("AB/00", "AB"), score("AB/XX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("42/00", "42"), score("42/XX", "42"), accuracy: 0.1)
XCTAssertEqual(score("00/AB", "AB"), score("XX/AB", "AB"), accuracy: 0.1)
XCTAssertEqual(score("00/42", "42"), score("XX/42", "42"), accuracy: 0.1)
}
func testCompareSearchNumbersAndLetters() {
XCTAssertEqual(score("42XX", "42"), score("ABXX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("0042", "42"), score("XXAB", "AB"), accuracy: 0.1)
XCTAssertEqual(score("42_00", "42"), score("AB_XX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("00_42", "42"), score("XX_AB", "AB"), accuracy: 0.1)
XCTAssertEqual(score("42/00", "42"), score("AB/XX", "AB"), accuracy: 0.1)
XCTAssertEqual(score("00/42", "42"), score("XX/AB", "AB"), accuracy: 0.1)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating StringRankedSearch and the unit-test target containing the score(...) helper. Use the demonstrated assertions as regression criteria for mixed numbers and letters, including separators and matches at either end. Done means all listed comparisons pass with the stated accuracy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile-dev, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100