Hyphens in advanced search - Bug?

I have a field with a hyphen in the value e.g. Lee-Bernstein

An advanced search on that field of "Lee-Bernstein" doesn't bring back the record

I noticed that in Providence's search builder it escapes the hyphen with a backslash, though in Pawtucket the advanced search "Lee\-Bernstein" doesn't bring back anything.

Is there some sort of config setting that I'm missing or is this a bug?

Comments

  • Advanced search is a direct database query from memory.

    You will most likely need to add DONT_TOKENIZE onto the ca_entities label fields in search_indexing.conf

    Just be warned that it will only work on records that are new or saved unless you reindex.

  • Thanks Monica

    This is actually an objects field so would I add the field and don't tokenise in the Fields subblock in the objects block? For example if I was to add surname:

    ca_objects = {
            fields = {
                    _metadata = { },                                        # forces indexing of all attributes
                    surname = {STORE, DONT_TOKENIZE },
                    parent_id = {STORE, DONT_TOKENIZE, DONT_INCLUDE_IN_SEARCH_FORM },
                    source_id = {},
                    lot_id = {},
                    idno = { STORE, DONT_TOKENIZE, INDEX_AS_IDNO, BOOST = 100 },
                    type_id = { STORE, DONT_TOKENIZE },
                    source_id = { STORE, DONT_TOKENIZE },
                    hier_object_id = { STORE, DONT_TOKENIZE },
                    access = { STORE, DONT_TOKENIZE },
                    status = { STORE, DONT_TOKENIZE },
                    deleted = { STORE, DONT_TOKENIZE },
                    is_deaccessioned = { STORE, DONT_TOKENIZE },
                    deaccession_notes = {},
                    deaccession_date = {},
                    circulation_status_id = { STORE, DONT_TOKENIZE }
            }
    


  • I am not sure what happens when you do that to an individual metadata element.

    The document says you can index them separately, but not about if you have both _metadata and one individual one. I suggest giving it a go, saving the problem record and seeing if it corrects the behaviour, if it does, then optionally reindex the ca_object table.

    Remember to prefix the metadata element with ca_attribute_ (eg. `ca_attribute_surname`)


    Monica

  • Thanks Monica

    I updated the block in search_indexing.conf as below, updated the record, but an advanced search on the field with a hyphen is still not retrieving it.

     ca_objects = {
            fields = {
                    _metadata = { },                                        # forces indexing of all attributes
                    ca_attribute_military_surname = {STORE, DONT_TOKENIZE },
                    ....
    

    I also tried removing the _metadata = {} but leaving the ca_attribute_military_surname, still didn't work after an update (since reverted)

    I also tried adding it as an access point with options including DONT_TOKENIZE but still didn't work.

    Not sure what to try next.

  • Once you've made a change, go and trigger a re-index of the record in question with an edit/save.

    Make sure you give a bit of time to make sure the indexing task has run before testing the search again.

    Contact me directly if needed.

  • edited August 31

    Yep I saved the record in Providence and waited a few hours before trying to Pawtucket Advanced Search

  • Did some digging about. Put an underscore in front of it. _ca_attribute_military_surname = {DONT_TOKENIZE} and add _metadata = {} back in.

  • Thanks Monica, I updated the search_indexing.conf as instructed, updated the record, waited a couple hours and unfortunately it is still not coming up in a search for the hyphenated name

  • There is a search_indexing.conf in both pawtucket and providence. These generally should be the same for indexing, but access_points can be different. If you are editing only the search_indexing.conf in pawtucket, make sure this change is also in providence and vice versa.

  • Thanks Monica, I updated Providence but unfortunately it is still not working.

Sign In or Register to comment.