Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Word search ordering and sorting #1

Open
WinteryFox opened this issue Nov 19, 2019 · 3 comments
Open

Word search ordering and sorting #1

WinteryFox opened this issue Nov 19, 2019 · 3 comments

Comments

@WinteryFox
Copy link
Owner

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
@WinteryFox WinteryFox pinned this issue Nov 19, 2019
@WinteryFox WinteryFox unpinned this issue Jan 8, 2020
@WinteryFox
Copy link
Owner Author

I have solved this temporarily in commit 9762d91
keeping this issue open because this will need massive tweaks

@saulable
Copy link

saulable commented Feb 1, 2020

Convert the characters to a char code, then sort each by that.

@WinteryFox
Copy link
Owner Author

That would be a method but not a very good one, words need to be sorted by relevancy/frequency because after all you would not want irregular words at the top of your search results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants