Skip to content

Word search ordering and sorting #1

@WinteryFox

Description

@WinteryFox

Currently, word searches are completely unsorted and will appear in a random order. I've been trying to figure out a proper way to order words (by frequency and/or relevance) however I've been unsuccessful so far. I've tried using the freq table to sort on the columns kw and value however that does not work properly.
Trying to figure out a proper way to sort words is tricky and will require more attention.

Ordering by kw and value does not yield favourable results;

SELECT entries.entr
FROM (SELECT entr
      FROM kanj
      WHERE lower(txt) $equals lower(:q)
      UNION ALL
      SELECT entr
      FROM rdng
      WHERE txt $equals hiragana(:reading)
         OR txt $equals katakana(:reading)
      UNION ALL
      SELECT entr
      FROM gloss
      WHERE lower(txt) $equals lower(:q)) entries
         LEFT JOIN freq ON freq.entr = entries.entr AND freq.rdng IS NOT NULL AND freq.kanj IS NULL
ORDER BY freq.kw, freq.value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions