You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Pablo Mendes <pa...@gmail.com> on 2011/02/09 18:06:10 UTC

HighFreqTerms patch

Guys,
this is tiny and probably not relevant. But I'll bet a beer that at least a
dozen people had to dirtymod this class while they could have run it from
command line.
A 15 min time save that took 15 min to create. I guess it's a tie.

Best,
Pablo

--- HighFreqTerms.java
+++ ExtractStopwords.java
@@ -30,7 +30,7 @@
 public class HighFreqTerms {

   // The top numTerms will be displayed
-  public static final int numTerms = 100;
+  public static int numTerms = 100;

   public static void main(String[] args) throws Exception {
     IndexReader reader = null;
@@ -40,6 +40,10 @@
     } else if (args.length == 2) {
       reader = IndexReader.open(args[0]);
       field = args[1];
+    } else if (args.length == 3) {
+      reader = IndexReader.open(args[0]);
+      field = args[1];
+      numTerms = new Integer(args[2]);
     } else {
       usage();
       System.exit(1);
@@ -71,7 +75,7 @@
   private static void usage() {
     System.out.println(
          "\n\n"
-         + "java org.apache.lucene.misc.HighFreqTerms <index dir>
[field]\n\n");
+         + "java org.apache.lucene.misc.HighFreqTerms <index dir> [field]
[numTerms] \n\n");
   }
 }

Re: HighFreqTerms patch

Posted by Pablo Mendes <pa...@gmail.com>.
You're right. My bad! I was looking at 2.9.3. :(
I guess I owe somebody a beer. :)

On Thu, Feb 10, 2011 at 12:16 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Sorry, I mean "let you specify numTerms".
>
> Mike
>
> On Wed, Feb 9, 2011 at 6:16 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
> > Hmm, which version of Lucene are you using?  Newer versions let you
> > specify a field...
> >
> > Mike
> >
> > On Wed, Feb 9, 2011 at 12:06 PM, Pablo Mendes <pa...@gmail.com>
> wrote:
> >> Guys,
> >> this is tiny and probably not relevant. But I'll bet a beer that at
> least a
> >> dozen people had to dirtymod this class while they could have run it
> from
> >> command line.
> >> A 15 min time save that took 15 min to create. I guess it's a tie.
> >>
> >> Best,
> >> Pablo
> >>
> >> --- HighFreqTerms.java
> >> +++ ExtractStopwords.java
> >> @@ -30,7 +30,7 @@
> >>  public class HighFreqTerms {
> >>
> >>   // The top numTerms will be displayed
> >> -  public static final int numTerms = 100;
> >> +  public static int numTerms = 100;
> >>
> >>   public static void main(String[] args) throws Exception {
> >>     IndexReader reader = null;
> >> @@ -40,6 +40,10 @@
> >>     } else if (args.length == 2) {
> >>       reader = IndexReader.open(args[0]);
> >>       field = args[1];
> >> +    } else if (args.length == 3) {
> >> +      reader = IndexReader.open(args[0]);
> >> +      field = args[1];
> >> +      numTerms = new Integer(args[2]);
> >>     } else {
> >>       usage();
> >>       System.exit(1);
> >> @@ -71,7 +75,7 @@
> >>   private static void usage() {
> >>     System.out.println(
> >>          "\n\n"
> >> -         + "java org.apache.lucene.misc.HighFreqTerms <index dir>
> >> [field]\n\n");
> >> +         + "java org.apache.lucene.misc.HighFreqTerms <index dir>
> [field]
> >> [numTerms] \n\n");
> >>   }
> >>  }
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: HighFreqTerms patch

Posted by Michael McCandless <lu...@mikemccandless.com>.
Sorry, I mean "let you specify numTerms".

Mike

On Wed, Feb 9, 2011 at 6:16 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
> Hmm, which version of Lucene are you using?  Newer versions let you
> specify a field...
>
> Mike
>
> On Wed, Feb 9, 2011 at 12:06 PM, Pablo Mendes <pa...@gmail.com> wrote:
>> Guys,
>> this is tiny and probably not relevant. But I'll bet a beer that at least a
>> dozen people had to dirtymod this class while they could have run it from
>> command line.
>> A 15 min time save that took 15 min to create. I guess it's a tie.
>>
>> Best,
>> Pablo
>>
>> --- HighFreqTerms.java
>> +++ ExtractStopwords.java
>> @@ -30,7 +30,7 @@
>>  public class HighFreqTerms {
>>
>>   // The top numTerms will be displayed
>> -  public static final int numTerms = 100;
>> +  public static int numTerms = 100;
>>
>>   public static void main(String[] args) throws Exception {
>>     IndexReader reader = null;
>> @@ -40,6 +40,10 @@
>>     } else if (args.length == 2) {
>>       reader = IndexReader.open(args[0]);
>>       field = args[1];
>> +    } else if (args.length == 3) {
>> +      reader = IndexReader.open(args[0]);
>> +      field = args[1];
>> +      numTerms = new Integer(args[2]);
>>     } else {
>>       usage();
>>       System.exit(1);
>> @@ -71,7 +75,7 @@
>>   private static void usage() {
>>     System.out.println(
>>          "\n\n"
>> -         + "java org.apache.lucene.misc.HighFreqTerms <index dir>
>> [field]\n\n");
>> +         + "java org.apache.lucene.misc.HighFreqTerms <index dir> [field]
>> [numTerms] \n\n");
>>   }
>>  }
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: HighFreqTerms patch

Posted by Michael McCandless <lu...@mikemccandless.com>.
Hmm, which version of Lucene are you using?  Newer versions let you
specify a field...

Mike

On Wed, Feb 9, 2011 at 12:06 PM, Pablo Mendes <pa...@gmail.com> wrote:
> Guys,
> this is tiny and probably not relevant. But I'll bet a beer that at least a
> dozen people had to dirtymod this class while they could have run it from
> command line.
> A 15 min time save that took 15 min to create. I guess it's a tie.
>
> Best,
> Pablo
>
> --- HighFreqTerms.java
> +++ ExtractStopwords.java
> @@ -30,7 +30,7 @@
>  public class HighFreqTerms {
>
>   // The top numTerms will be displayed
> -  public static final int numTerms = 100;
> +  public static int numTerms = 100;
>
>   public static void main(String[] args) throws Exception {
>     IndexReader reader = null;
> @@ -40,6 +40,10 @@
>     } else if (args.length == 2) {
>       reader = IndexReader.open(args[0]);
>       field = args[1];
> +    } else if (args.length == 3) {
> +      reader = IndexReader.open(args[0]);
> +      field = args[1];
> +      numTerms = new Integer(args[2]);
>     } else {
>       usage();
>       System.exit(1);
> @@ -71,7 +75,7 @@
>   private static void usage() {
>     System.out.println(
>          "\n\n"
> -         + "java org.apache.lucene.misc.HighFreqTerms <index dir>
> [field]\n\n");
> +         + "java org.apache.lucene.misc.HighFreqTerms <index dir> [field]
> [numTerms] \n\n");
>   }
>  }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org