Quick search on "Title, Creator, Year" not show rich-text titled ITEM-s (sub/sup/italic markup)

edited today at 10:38am
In the item list quick search (mode “Title, Creator, Year”), a query that crosses a rich-text formatting boundary in a title does not match. For example: an item whose title is stored as MoS<sub>2</sub> (the “2” is a subscript) is not found when searching for "MoS2", even though the user can clearly see the item in the list with the title “MoS₂”. Searching "MoS" alone does find it.


Zotero 9.0.6 (64-bit)
Better BibTeX citation key formula:
auth.lower + shorttitle(3,3) + year
ItemCitation KeyShort title
1babuskaTemperatureDependentFrictionWear2016
2yangMicroscopicAtomisticMechanisms2021Microscopic and atomistic mechanisms of sliding friction of MoS2
3seitzmanXrayDiffractionMoS21992

Title, Creator, Year quick search matches: title, year, creator, shortTitle and citationKey
and thus results are following:
ItemSearch
'mos'
Search
'mos2'
SELECT
by
1none
2short title
3Citation Key

[1] T.F. Babuska, A.A. Pitenis, M.R. Jones, B.L. Nation, W.G. Sawyer, N. Argibay, Temperature-Dependent Friction and Wear Behavior of PTFE and MoS2, Tribol Lett 63 (2016) 15. https://doi.org/10.1007/s11249-016-0702-y.
[2] Z. Yang, S. Bhowmick, F.G. Sen, A.T. Alpas, Microscopic and atomistic mechanisms of sliding friction of MoS2: Effects of undissociated and dissociated H2O, Applied Surface Science 563 (2021) 150270. https://doi.org/10.1016/j.apsusc.2021.150270.
[3] L.E. Seitzman, R.N. Bolster, I.L. Singer, X-ray diffraction of MoS2 coatings prepared by ion-beam-assisted deposition, Surface and Coatings Technology 52 (1992) 93–98. https://doi.org/10.1016/0257-8972(92)90375-K.

[1] T.F. Babuska, A.A. Pitenis, M.R. Jones, B.L. Nation, W.G. Sawyer, N. Argibay, Temperature-Dependent Friction and Wear Behavior of PTFE and MoS<sub>2</sub>, Tribol Lett 63 (2016) 15. https://doi.org/10.1007/s11249-016-0702-y.
[2] Z. Yang, S. Bhowmick, F.G. Sen, A.T. Alpas, Microscopic and atomistic mechanisms of sliding friction of MoS<sub>2</sub>: Effects of undissociated and dissociated H<sub>2</sub>O, Applied Surface Science 563 (2021) 150270. https://doi.org/10.1016/j.apsusc.2021.150270.
[3] L.E. Seitzman, R.N. Bolster, I.L. Singer, X-ray diffraction of MoS<sub>2</sub> coatings prepared by ion-beam-assisted deposition, Surface and Coatings Technology 52 (1992) 93–98. https://doi.org/10.1016/0257-8972(92)90375-K.


https://s3.amazonaws.com/zotero.org/images/forums/u4845974/6kxetjnnrlsppwutlsqg.gif

https://s3.amazonaws.com/zotero.org/images/forums/u4845974/es2lrat65clsqxhcx3a2.png
https://s3.amazonaws.com/zotero.org/images/forums/u4845974/ozclro1xngu2vegf21rb.png
https://s3.amazonaws.com/zotero.org/images/forums/u4845974/w6ittuu49hvzj8hi4ame.png

132642 Zotero HTML markup title search — source files
  • Root cause — why the title itself never matches

    The “Title, Creator, Year” search does a substring match (value LIKE '%mos2%') against the raw stored field value, which still contains the formatting tags. So MoS2 is compared against the literal string MoS<sub>2</sub> and cannot match — the characters <sub> sit between MoS and 2. Searching MoS matches the MoS prefix, which is why MoS alone finds it. The item list renders those tags as a real subscript (renderItemTitle()), so the stored value and the displayed value differ and there is no visible cue that a formatted title is being searched.

    Zotero already strips exactly these tags — but only for sorting, not for searching

    Zotero.Items.getSortTitle() builds the sort key by removing the same markup set — <i>, <b>, <sub>, <sup>, <span style="font-variant:small-caps;">, <span class="nocase">, </span> (the _stripFromSortTitle list in data/items.js). That same normalization is simply not applied on the search path (data/search.js). Matching against the tag-free form on search (i.e. reusing the stripping logic that already exists for sorting) would make MoS2 find MoS<sub>2</sub> regardless of whether shortTitle/citationKey happen to hold a plain-text copy — and would fix the same problem for italic/superscript/small-caps titles too.
Sign In or Register to comment.