5

Is there a way to do sorting of questions based on:

  • number of views?

  • number of views per (some time frame)

  • frequently asked, without answers

  • number of votes for questions, without answers

  • number or user reputation

Or other options for sorting and searching for questions I might care about answering.
perhaps I am simply missing options for searching.

2 Answers 2

6

If you need advanced sorting: Stack Exchange Data Explorer

(Link)

(DBSchema Documentation)

(As per Dan's comment, the data is updated early every Monday morning around 3:00 UTC)

  • [Most viewed questions](https://data.stackexchange.com/askubuntu/query/298608/most-viewed-questions)

SELECT TOP ##Number## Id AS [Post Link], ViewCount
FROM Posts
WHERE PostTypeId = 1
ORDER BY ViewCount DESC;

-- Number: Number of posts to show:
  • [Most viewed questions between date X and date Y](https://data.stackexchange.com/askubuntu/query/298621/most-viewed-questions-between-date-x-and-date-y)

SELECT TOP ##Number## Id AS [Post Link], ViewCount, CreationDate
FROM Posts
WHERE PostTypeId = 1 AND CreationDate BETWEEN ##FromCreationDate:string## AND ##ToCreationDate:string##
ORDER BY ViewCount DESC;

-- Number: Number of posts to show:
-- FromCreationDate: From YYYY-MM-DD
-- ToCreationDate: To YYYY-MM-DD
  • [Most frequently asked (not answered) questions](https://data.stackexchange.com/askubuntu/query/298604/most-frequently-asked-not-answered-questions)

SELECT TOP ##Number## a.Id AS [Post Link], b.NumberOfDuplicates
FROM Posts AS a
LEFT JOIN
(SELECT Posts.Id, COUNT(PostLinks.RelatedPostId) AS NumberOfDuplicates
FROM Posts, PostLinks
WHERE Posts.Id = PostLinks.RelatedPostId AND PostLinks.LinkTypeId = 3
GROUP BY Posts.Id)
AS b ON a.Id = b.Id
WHERE a.AnswerCount = 0
ORDER BY b.NumberOfDuplicates DESC;

-- Number: Number of posts to show:
  • [Most voted (not closed and not answered) questions](https://data.stackexchange.com/askubuntu/query/298628/most-voted-not-closed-and-not-answered-questions)

SELECT TOP ##Number## Id AS [Post Link], Score
FROM Posts
WHERE PostTypeId = 1 AND ClosedDate IS NULL AND AnswerCount = 0
ORDER BY Score DESC;

-- Number: Number of posts to show:
  • [Latest (not closed) questions from users with reputation
SELECT TOP ##Number## Posts.Id AS [Post Link], Users.Reputation
FROM Posts, Users
WHERE Posts.OwnerUserId = Users.Id AND Posts.PostTypeId = 1 AND Posts.ClosedDate IS NULL AND Users.Reputation < ##UserReputationThreshold##
ORDER BY Posts.CreationDate DESC;

-- Number: Number of posts to show:
-- UserReputationThreshold: User's reputation threshold:
12
  • For user reputation, I mean users with less that 500 rep for example. How come the compose query button isn't in the ask Ubuntu page (or is it? I never saw it, but that is definitely the thing i want.)
    – j0h
    Commented Apr 9, 2015 at 10:28
  • Now That I am looking, in the database Scheme, there is Reputation an int.
    – j0h
    Commented Apr 9, 2015 at 10:33
  • @j0h Well aside from the fact that you must know a bit of SQL to use it, it's not useful for most of the users. I think moderators have their own prebuilt tools to do more advanced tasks
    – kos
    Commented Apr 9, 2015 at 10:33
  • @j0h I'm building that query as well
    – kos
    Commented Apr 9, 2015 at 10:35
  • Will it always ask me If I am a bot? / capcha? .... I prolly ought to learn some more SQL but feel free to keep helping lol. Thank you very much!
    – j0h
    Commented Apr 9, 2015 at 10:38
  • @j0h You're welcome, I think you need to login with OpenID via Stack Exchange to get rid of the captcha
    – kos
    Commented Apr 9, 2015 at 10:40
  • @j0h How do you need the last query to be sorted, latest first I guess?
    – kos
    Commented Apr 9, 2015 at 10:40
  • Yeah, that would be great
    – j0h
    Commented Apr 9, 2015 at 10:47
  • @j0h Addedd, I also added a link to the DBSchema documentation as a reference for building new queries
    – kos
    Commented Apr 9, 2015 at 10:57
  • @j0h I'm stopping here commenting before a moderator moves everything to the chat, but notice that the last one is not very useful because all those queries are sent to a database dump which is a few days older
    – kos
    Commented Apr 9, 2015 at 10:59
  • 1
    Just a side note that probably should be mentioned. The data in the data explorer is not very up-to-date. It is updated once per week. Mondays around 3:00 UTC to be more precise.
    – Dan
    Commented Apr 9, 2015 at 14:33
  • @Dan True, updated
    – kos
    Commented Apr 9, 2015 at 15:07
1

If you don't need advanced sorting: Regular search

Scraped from How do I search?

How do I search?

Enter search terms in the search box that appears in the upper right corner of every page, and press Enter.

If you need to refine and narrow your search, here are some basic tips:

  • To search within specific tag(s), enter them in square brackets: [maintenance] seat searches for mentions of "seat" within the [maintenance] tag.
  • To find a specific phrase, or to search a string of special characters, enter it in quotes: like "flat tire", or "<%#".
  • To limit your search to just the title of a question, use title: followed by the search term. Likewise, search the body only (exclude the title) with body:"phrase here".
  • To search just your posts: user:me training searches all of your posts for the word "training".
  • To exclude results from a tag, term or phrase, prefix it with - in your query: waffles -unicorns finds posts that mention tasty batter-based breakfasts without including mythical creatures, while [laurel] -[hardy] includes only posts pertaining to the first half of the classic comedy couple.
  • Use wildcard searches to broaden results; add an asterisk (*) anywhere in the word, like encour* or Ex*nge.

Advanced Search Options:

We offer a number of advanced search operators to help you find very specific information.

Range Operators

To search for only questions that fall within a particular range for score, number of answers, or number of views, you can enter an upper or lower parameter, or a range.

  • score:-1 or score:-1.. will both return posts with a score greater than or equal to -1
  • views:500..1000 or views:500-1000 will return posts with 500 to 1000 views
  • answers:..3 will return questions with 3 or fewer answers

Dates

You can use specific dates or date ranges to narrow results down to posts created or active within a certain time period, using the following operators:

  • created: to specify when the posts were created
  • lastactive: for posts active in a specified time period

Dates can be entered in the following formats:

  • Absolute dates:

    • year only – e.g., created:2012..2013 searches posts created from January 1, 2012 through December 31, 2013; created:2012 searches posts created from January 1, 2012 through December 31, 2012.
    • year and month – e.g., created:2012-04..2012-05 searches posts created between April 1, 2012 and May 31, 2012.
    • day, month, and year – e.g., lastactive:2012-04-03 searches posts who were last active between 12:00 AM on April 3, 2012 and 11:59 PM on April 3, 2012.
  • Relative dates:

    • 1y, 1m, and 1d are shorthand for "last year", "last month", and "yesterday" - e.g., if today is April 15, created:1m searches posts created between March 1 and March 31. (You can substitute any number for 1 to look back that many years, months, or days.)

    • Relative datas in a range (1y..) look back to the same date in the previous period - e.g., if you want to see all the posts active in the last three months, use lastactive:3m.. On April 15, that will show posts from January 15 up to the most recently active. You can close the range as well: lastactive:3m..1m.

Please note that all times are recorded in UTC; the results may not match your timezone.

User Operators

You can also limit searches to a specific user's content (your own or someone else's). You will need the user id to search another user's posts.

  • user:mine or user:me (or any user id) returns only your posts (or only the posts from whichever user whose id you entered)
  • infavorites:mine (or any user id) returns only questions that you (or the user whose id you entered) have favorited.
  • intags:mine returns only posts that appear in tags you have marked as favorite. (If you don't have any tags, this operator does nothing. For better results, update your preferences.)

Boolean Operators

The following search operators can be used with values of yes/no, true/false, or 1/0 (each pair behaves the same):

  • isaccepted: yes/true/1 returns only answers that have been marked "accepted"; no/false/0 returns only answers that are not marked accepted.
  • hascode: yes/true/1 returns only posts that contain code blocks; no/false/0 returns only posts that contain no code.
  • hasaccepted: yes/true/1 returns only questions that have accepted answers; no/false/0 returns only questions with no accepted answers.
  • isanswered: yes/true/1 returns only questions that have at least one accepted or positively-scored answer; no/false/0 returns only questions with no accepted or positively-scored answers.
  • closed: yes/true/1 returns only questions that are closed; no/false/0 excludes closed questions from the search.
  • duplicate: yes/true/1 returns questions that have been marked as a duplicate of another question; no/false/0 excludes duplicate questions from the search.
  • migrated: yes/true/1 returns only questions that have been migrated to a different site; no/false/0 excludes migrated questions from the search.
  • locked: yes/true/1 returns only locked posts (which have edits, votes, comments, and new answers disabled); no/false/0 returns only posts that are not locked.
  • hasnotice: yes/true/1 returns only posts with a notice shown below them; no/false/0 returns only posts that do not have a notice applied.
  • wiki: yes/true/1 returns only community wiki posts; no/false/0 returns only non-community wiki posts.

OR operator

To combine results from multiple tags, separate the tag names (enclosed in square brackets) with the word "or": [widgets] or [geegaws] returns questions tagged with either tag.

Miscellaneous Operators

  • url:"example.com" searches for posts containing the url "example.com"
  • is:question narrows results down to just questions, and is:answer returns only answers
  • inquestion:50691 restricts the search to the question with id 50691. If you are searching using the search box on a question page, you can use inquestion:this to restrict results to the post you are already viewing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .