Skip to content

Fix duplicate selection of books. #6

Open
@bmschmidt

Description

@bmschmidt

Unconfirmed: but it seems that in the case of multi-field queries, some books may be being duplicated; so if you're searching for EITHER "whaling" or "fiction" in subject, say, Moby Dick's word count might be counted once for whaling AND once for fiction, which is obviously extremely bad behavior.

The fix is actually somewhat difficult; probably the way to do it is with a materialized table operating on an "IN" query rather than a join, which:

  1. Is only possible on MySQL 5.6 or later, I believe, with an automatically derived index on the materialized table, which is the only way this will be fast.
  2. Will slow down, probably only a little, any queries involving it since the index needs to be built anew. Depending on the speed effect, it might be worth only applying this to queries that use non-unique metadata items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions