ISBN search only finds records with both 10 and 13 digit ISBNs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Eg 3.0.2
After receiving reports of records not showing up for ISBN searches I noticed that the SQL query generated for ISBN searches becomes a search for the 10 digit and 13 digit ISBNs in a single record because these lines:
to_tsquery(
to_
turn that ISBN into this ts_query:
'9780899978482' & '0899978487'
Which does exactly what it looks like, requires both values to be considered a match.
This can be corrected by changing the regexp_replace call to use a pipe rather than an ampersand:
to_tsquery(
to_
I assume this change should be limited to ISBNs because of their unusual nature but I don't have time to look into that today and wanted to get this down while it's fresh in my mind.
I don't think we want to do a blanket change there, as that is a construct used by all normalizers.
It would be wrong to join the output of, say, the date range normalizer with | instead of &. I think we'll need to teach the normalizer mapping table and the code that constructs this clause about how the output should be joined.