2

I have started to use queries to find some interesting unanswered questions, most specifically this query : https://data.stackexchange.com/stackoverflow/query/4038/find-interesting-unanswered-questions

-- Find interesting unanswered questions
-- Looks at unanswered questions in your top 20 tags and sorts them by
-- a combined weight which takes into account: score, askers reputation and how
-- well you do on that particular tag

DECLARE @UserId int = ##UserId##

create table #tags (TagId int, [Count] int)

insert #tags 
SELECT TOP 20 
    TagId,
    COUNT(*) AS UpVotes 
FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
    INNER JOIN Votes ON Votes.PostId = Posts.Id and VoteTypeId = 2
WHERE 
    Posts.OwnerUserId = @UserId
GROUP BY TagId
ORDER BY UpVotes DESC


create table #unanswered (Id int primary key)

insert #unanswered 
select q.Id  from Posts q
where (select count(*) from Posts a where a.ParentId = q.Id and a.Score > 0) = 0
and CommunityOwnedDate is null and ClosedDate is null and q.ParentId is null 
and AcceptedAnswerId is null


select top 2000 u.Id as [Post Link], 
(sum(t.[Count]) / 10.0 + us.Reputation / 200.0 + p.Score * 100) as Weight 
from #unanswered u
join Posts p on u.Id = p.Id
join PostTags pt on pt.PostId = u.Id
join #tags t on t.TagId = pt.TagId  
join Users us on us.Id = p.OwnerUserId  
group by u.Id, us.Reputation, p.Score 
order by Weight desc 

However, after some days using it (answering question that I can answer), only questions that I can't answer remain at the top of the query. As I somewhat always make some effort to interact with questions (up / down vote / favorite / comment), I was thinking about filtering questions which I already interacted with.

However, I lack the skill to introduce such a filter, any idea how I could do that ?

  • Can you explain more about the criteria "questions which I already interacted with" please? Viewed, commented, voted or what? – πάντα ῥεῖ Mar 7 at 10:54
  • 1
    As stated : up / down voted / favorited / commented would be a good start – lcrmorin Mar 7 at 10:57
  • I am afraid that "up / down voted / favorited" aren't accessible as published information. – πάντα ῥεῖ Mar 7 at 10:59
  • @πάνταῥεῖ favorited is (votetypeid = 5 in the votes table and has your userid). The rest is correct. – rene Mar 7 at 11:01
2

However, I lack the skill to introduce such a filter, any idea how I could do that ?

At least for voting you can't. This information isn't published in the SE data model.

As @rene commented you can filter out questions you already favorited, same for comments.

|improve this answer|||||
  • Okay thanks. I tried to narrow down my question to a specific query / approach. However I am a bit unsatisfied by your answer, as I don't think it would be okay to comment every question I open, just for tracking purposes... Broadly speaking, any idea on one can get "unseen" questions ? (Also congrats on your 10k rep) – lcrmorin Mar 7 at 11:48
  • @lcrmorin "as I don't think it would be okay to comment every question I open" Well, if you can't give an answer immediately, it's probably essential to ask for clarification in comments. Also favoriting each question you visited doesn't seem to be a very practical way. Maybe change your strategy to find questions you can answer completely, instead of using that query. – πάντα ῥεῖ Mar 7 at 11:53

You must log in to answer this question.

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