ErwinKomen / RU-passim

0 stars 0 forks source link

SSG links: search #432

Closed MennaRempt closed 2 years ago

MennaRempt commented 3 years ago

When adding links (both between Sermon-SSG and SSG-SSG), it is often difficult to find the correct SSG to link to. There should be a possibility to search for exact strings (e.g. using quotation marks? those should not occur in any incipit/explicit or signatures), and results that correspond most closely to the search terms should be at the top of the list of results. So, when searching for CAE s 100, 'CAE s 100' and 'CAE s 100A' should be the first results, then followed by e.g. AU s 100. Currently seaching for "CAE s 100" gives all Caesarian sermons as results, since they have "CAE s " and "100-" (from CPL 1008.#) in them.

NB. it should still be possible to search for non-exact strings, e.g. for an author + word from the incipit/explicit combination.

ErwinKomen commented 2 years ago

Note

This is related to issue #292 from 2020

Implementation

  1. Link between Sermon-SSG
    1. This is in the SermonDescrSuperForm
    2. The showing of possible SSGs is via widget SuperOneWidget
    3. This widget already has a custom filter_queryset() implementation, which puts 'direct hits' above (as per django-select2 issue ) - this is about 'containing' particular string(s)
      1. This already targets the example - except for not requiring quotation marks
      2. Adapted according to specifications (complex...)
  2. Link between SSG-SSG
    1. This is in the EqualGoldLinkForm
    2. And then the widget (for newsuper) is: EqualGoldWidget
    3. Adapted that widget with a filter_queryset() as above
ErwinKomen commented 2 years ago

Behaviour

  1. Without double quote marks: as before
  2. With double quote marks, e.g. "CAE s 100", as specified above
MennaRempt commented 2 years ago

When linking an AF to a manifestation, it is now only possible to search for exact strings, whether double quote marks are used or not.

ErwinKomen commented 2 years ago

Can you clarify? Perhaps with an example? I had implemented and am seeing a marked difference between the two options.

Option 1: without quotation marks

The order is as in issue #292 image

Option 2: with quotation marks

The order is as per this issue #432 image

MennaRempt commented 2 years ago

Without quotation marks, you can search for an exact string, as in Screenshot 2022-06-01 120601

but adding information elsewhere in the AF information , e.g. part of the Gryson code (which should be possible) means that the results are no longer found: Screenshot 2022-06-01 120658

ErwinKomen commented 2 years ago

Well, if one types per moysen hi, the search algorithm tries to look for any field (code, author name, incipit, explicit, signature) that contains per moysen hi in upper or lower case. So it is logical that no results are found.

If one types "per moysen" hi, the idea is that it looks for two 'chunks' in all of those fields: (a) per moysen and (b) hi

How would one expect the system to search?? E.g: when the user types per moysen hi, then search and order the AFs, by...???

Result

Okay, I've now done it using this scheme:

Notes

MennaRempt commented 2 years ago

Works perfectly now!