Skip to content

author_search column of metadata.azgs does not include organization #92

@NoisyFlowers

Description

@NoisyFlowers

The author_search column of metadata.azgs is a tsvector that is built with the following sql:

			SELECT  
				k.authors
			FROM (
				SELECT 
					string_agg(author, ';') as authors
				FROM (
					select 
						jsonb_array_elements(
							json_data #> 
								'{"authors"}'					
						) 
						#>> '{"person"}' 
					  as author from tabletemp
				) as a
			) k

Note that this sql only uses the person field of an author in building the tsvector. These can be null if the author attribute is an organization.

This means that searching for something like "AZGS" through the library client will return no results, even if there are collections that have the organization field of author filled out.

I don't know if this is common outside of my synthetic test db, and fixing it will require some discussion and a lot of testing to make sure we do not break text search in the process.

One approach might be to modify the above sql like so:

			SELECT  
				k.authors
			FROM (
				SELECT 
					string_agg(author, ';') as authors
				FROM (
					select 
					CONCAT_WS(',', 
						jsonb_array_elements(
							json_data #> 
								'{"authors"}'					
						) 
						#>> '{"person"}',
						jsonb_array_elements(
							json_data #> 
								'{"authors"}'					
						) 
						#>> '{"organization"}' 
					)  
					  as author from tabletemp
				) as a
			) k

But this would require significant testing.

I'm opening this as a question for now until we decide if it's a bug or a feature request or what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions