1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Searching for the frequency of a word

Discussion in 'Off Topic' started by ChemicalKicks, Nov 7, 2011.

  1. ChemicalKicks

    ChemicalKicks Well-Known Member

    How would I go about getting the frequency of use for a specific word across all posts in my forum?
     
  2. Fuhrmann

    Fuhrmann Well-Known Member

    Testing a query in here...
     
  3. ChemicalKicks

    ChemicalKicks Well-Known Member

    (n)

    :D Nope more like a SQL query
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can search posts for a word. And you can count the number of matching posts. But I don't know of a way to count the number of occurrences of a word in a post with just SQL.
     
    ChemicalKicks likes this.
  5. ChemicalKicks

    ChemicalKicks Well-Known Member

    Bugger, I thought I could count the individual instances of a word. How would I count the number of posts that contained a specific word?
     
  6. Fuhrmann

    Fuhrmann Well-Known Member

    You can use this SQL query and then count the results.

    Code:
    SELECT post_id
    FROM xf_post
    WHERE message LIKE '%da%'
    GROUP by post_id
    
     
    ChemicalKicks likes this.
  7. ChemicalKicks

    ChemicalKicks Well-Known Member

    That will give number of posts with the word but not the frequency of the word within all posts? :)
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    If the table isn't too large, you can download it and open it in Notepad++.

    You can then search for the word and it will return the total number.
     
    ChemicalKicks likes this.
  9. Fuhrmann

    Fuhrmann Well-Known Member

    Yes.
     
    ChemicalKicks likes this.
  10. ChemicalKicks

    ChemicalKicks Well-Known Member

    Don't know how large the post table is but the database is about 1Gb, I think notepad might not be impressed :D
     
  11. ChemicalKicks

    ChemicalKicks Well-Known Member

    This worked best.

    The word occurred no less than 77,000 hehehe
     

Share This Page