代码改变世界

资源工具

2012-11-19 11:32  三戒1993  阅读(79)  评论(0编辑  收藏  举报

持续更新中....

如何结合使用 SVN 和 Eclipse
http://www.51zxw.net/study.asp?vip=6330545


 followers:[100 TO *]

should do what you want: see your query with 100 or more followers.
(Note: the "TO" needs to be in uppercase)

(Source: New and Improved Search)

For example, we can search:

  • for people with a username fuzzily similar to ‘chacon
  • who use Ruby as their primary language,
  • have at least 5 repos and
  • at least one follower:
search Users using Ruby

chacon~0.3 repos:[5 TO *] followers:[1 TO *]




I would like to make an advanced search for repos under github for commits which match the conditions below:

  • Language: Javascript
  • Created: [2011-01-01 TO NOW]
  • Pushed: [2012-05-01 TO NOW]
  • Forks: [100 TO *]
  • Size: [100 TO 1000] //(kb)

I know that github uses Lucene to perform its searchs, but searching around I can't find any documentation on query syntax, and if I follow the guidelines of the apache Lucene documentation I often end up with an "Invalid query syntax" message.

For my personal query I have already passed the language, size and forks queries with no problem, but I still have problem to find a good match to perform a query syntax based on dates.

Is it mandatory that I have to include the Timestamp in the date queries?
Could I make some computation for dates like NOW - 3MONTHS?
For example, how could I search repos that were created 4 MONTHS AGO TO NOW?

EDIT:

I talked to github support and they said to me that they use the Solr query syntax which allows the date range queries using calculations such as NOW - 4MONTHS, but for some reason it doesn't work ok for me or I just don't understand how these filters operate (created and pushed).

Just to test it, I tried to find any Repos, with Javascript as the main language, both of this selected from the combo boxes and then try to search using the [created} filter and see what strange results I have.

For the first search I try to find any javascript repo created between today and 12 months ago.

created:[NOW-12MONTHS/DAY TO NOW/DAY]

That gives me a total of 233500 Repos and I have listed the "twitter/bootstrap" repo at the top.

For the second search I tried to find any Javascript repo created between today and 24 months ago.

created:[NOW-24MONTHS/DAY TO NOW/DAY]

Not only it gives me less repos than before, 11867 in total, but I don't have the "twitter/bootstrap" repo listed any more in the results page (which I think is wrong because my second search "contains" the first one). The first result has less watchers than "twitter/bootstrap" and if I order the results by watchers count it would be wrong to not have it at the top!

I'm not saying that there is a bug on the site, but I just don't understand how it works for doing calculations with date ranges. Hope someone can help me clarify my issues.

share|improve this question

50% accept rate
 
Was this post useful to you?     

3 Answers

It's ugly, but you could wrap a layer around the search that interprets these date queries specially. For example, rewriting "Created:[NOW-4MONTHS to NOW]" to "Created:[2012-01-21 TO 2012-05-20]" before passing the query to Lucene.

Among the problems you'll have with this approach:

  • You need to come up with the wrapper query syntax.
  • You need to parse the wrapper query syntax correctly.
  • You need to rewrite your wrapper query syntax correctly into Lucene's syntax.

As far as I know, a range query cannot have a subquery inside of it, so you might be able to just use regular expressions to detect your date range queries, especially if you can count on specific field name(s) for the date/time queries.

share|improve this answer
 
Thanks for your kidness :) I guess I don't want to parse the query, I just want to know why it doesn´t work fine for me if github allows the Solr query sintax which allows me to use a sentence like NOW - xMONTHS – denica May 21 '12 at 8:44
feedback

Note that since November 26th, 2012 ("Search Syntax Improvements") (by Tim Pease), the Solr-style syntax for comparison and range criteria is no longer the only alternative.

So searching for items with more than 10 stars looked like:

stars:[10 TO *]

Now it is:

stars:>10

However range doesn't support Solr-like syntax like now, you need to specify dates, but withouttimestamps.

cats pushed:2012-04-30..2012-07-04

share|improve this answer
 
feedback

Check the Solr documentation page for exact syntax: http://wiki.apache.org/solr/SolrQuerySyntax

For the date searches the syntax is like this:

created:[2008-01-01T00:00:00Z TO NOW]

I would like to make an advanced search for repos under github for commits which match the conditions below:

  • Language: Javascript
  • Created: [2011-01-01 TO NOW]
  • Pushed: [2012-05-01 TO NOW]
  • Forks: [100 TO *]
  • Size: [100 TO 1000] //(kb)

I know that github uses Lucene to perform its searchs, but searching around I can't find any documentation on query syntax, and if I follow the guidelines of the apache Lucene documentation I often end up with an "Invalid query syntax" message.

For my personal query I have already passed the language, size and forks queries with no problem, but I still have problem to find a good match to perform a query syntax based on dates.

Is it mandatory that I have to include the Timestamp in the date queries?
Could I make some computation for dates like NOW - 3MONTHS?
For example, how could I search repos that were created 4 MONTHS AGO TO NOW?

EDIT:

I talked to github support and they said to me that they use the Solr query syntax which allows the date range queries using calculations such as NOW - 4MONTHS, but for some reason it doesn't work ok for me or I just don't understand how these filters operate (created and pushed).

Just to test it, I tried to find any Repos, with Javascript as the main language, both of this selected from the combo boxes and then try to search using the [created} filter and see what strange results I have.

For the first search I try to find any javascript repo created between today and 12 months ago.

created:[NOW-12MONTHS/DAY TO NOW/DAY]

That gives me a total of 233500 Repos and I have listed the "twitter/bootstrap" repo at the top.

For the second search I tried to find any Javascript repo created between today and 24 months ago.

created:[NOW-24MONTHS/DAY TO NOW/DAY]

Not only it gives me less repos than before, 11867 in total, but I don't have the "twitter/bootstrap" repo listed any more in the results page (which I think is wrong because my second search "contains" the first one). The first result has less watchers than "twitter/bootstrap" and if I order the results by watchers count it would be wrong to not have it at the top!

I'm not saying that there is a bug on the site, but I just don't understand how it works for doing calculations with date ranges. Hope someone can help me clarify my issues.

share|improve this question

50% accept rate
 
Was this post useful to you?     

3 Answers

It's ugly, but you could wrap a layer around the search that interprets these date queries specially. For example, rewriting "Created:[NOW-4MONTHS to NOW]" to "Created:[2012-01-21 TO 2012-05-20]" before passing the query to Lucene.

Among the problems you'll have with this approach:

  • You need to come up with the wrapper query syntax.
  • You need to parse the wrapper query syntax correctly.
  • You need to rewrite your wrapper query syntax correctly into Lucene's syntax.

As far as I know, a range query cannot have a subquery inside of it, so you might be able to just use regular expressions to detect your date range queries, especially if you can count on specific field name(s) for the date/time queries.

share|improve this answer
 
Thanks for your kidness :) I guess I don't want to parse the query, I just want to know why it doesn´t work fine for me if github allows the Solr query sintax which allows me to use a sentence like NOW - xMONTHS – denica May 21 '12 at 8:44
feedback

Note that since November 26th, 2012 ("Search Syntax Improvements") (by Tim Pease), the Solr-style syntax for comparison and range criteria is no longer the only alternative.

So searching for items with more than 10 stars looked like:

stars:[10 TO *]

Now it is:

stars:>10

However range doesn't support Solr-like syntax like now, you need to specify dates, but withouttimestamps.

cats pushed:2012-04-30..2012-07-04

share|improve this answer
 
feedback

Check the Solr documentation page for exact syntax: http://wiki.apache.org/solr/SolrQuerySyntax

For the date searches the syntax is like this:

created:[2008-01-01T00:00:00Z TO NOW]

 November 26, 2012  TwP

Search Syntax Improvements

Today we are announcing simplified syntax for adding comparison and range criteria to searches. Previously we relied on Solr-style syntax, so searching for items with more than 10 stars would look like stars:[10 TO *]. The new syntax simplifies this tostars:>10.

Greater Than Queries

Let's find all repositories that have something to do with "cats", and that have been starred 10 or more times by other GitHub users. All the following search examples are equivalent:

Less Than Queries

What about if we are interested in the less popular "cats" repositories? We can find them using the new syntax as well:

Range Queries

Our search updates also improve the syntax for range queries. Say we're looking for "cats" repositories that were last updated between the end of April and July 4th of 2012. Using the new syntax this would look like:

Omitting Spaces

If you prefer a more compact notation and typing fewer characters, you can omit the quotations and the space characters for any of these range criteria. Quotations need to be included only if the range value contains whitespace.

Have feedback? Let @github know on Twitter

We make sure to read every mention on Twitter. If you find a bug, submit it tosupport@github.com. Every email is read by a real person.


版权声明:本文为博主原创文章,未经博主允许不得转载。