Changeset 12981 for trunk/indexers


Ignore:
Timestamp:
2006-10-03T16:44:17+13:00 (18 years ago)
Author:
mdewsnip
Message:

Tidied up command-line option parsing in preparation for allowing the query string to be specified as a command-line option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java

    r12980 r12981  
    4343    static private String[] stop_words = StandardAnalyzer.STOP_WORDS;
    4444
     45    // Command-line options
     46    static private String fuzziness = null;
     47    static private Filter filter = null;
     48    static private Sort sorter = new Sort();
     49    static private String default_conjuction_operator = "OR";
     50    static private int start_results = 1;
     51    static private int end_results = Integer.MAX_VALUE;
     52
    4553
    4654    static public void main (String args[])
     
    5967        QueryParser query_parser_no_stop_words = new QueryParser(TEXTFIELD, new StandardAnalyzer(new String[] { }));
    6068
    61         Sort sorter = new Sort();
    62         Filter filter = null;
    63         String fuzziness = null;
    64 
    65         // Paging
    66         int start_results = 1;
    67         int end_results = Integer.MAX_VALUE;
    68 
    69             // New code to allow the default conjunction operator to be
    70             // definable
    71             String default_conjuction_operator = "OR";
    7269            for (int i = 1; i < args.length; i++) {
    7370        if (args[i].equals("-sort")) {
     
    7572            sorter = new Sort(args[i]);
    7673        }
    77         if (args[i].equals("-filter")) {
     74        else if (args[i].equals("-filter")) {
    7875            i++;
    7976            filter = parseFilterString(args[i]);
    8077        }
    81         if (args[i].equals("-dco")) {
     78        else if (args[i].equals("-dco")) {
    8279            i++;
    8380            default_conjuction_operator = args[i];
    8481        }
    85         if (args[i].equals("-fuzziness")) {
     82        else if (args[i].equals("-fuzziness")) {
    8683            i++;
    8784            fuzziness = args[i];
    8885        }
    89         if (args[i].equals("-startresults")) {
     86        else if (args[i].equals("-startresults")) {
    9087            i++;
    9188            if (args[i].matches("\\d+")) {
     
    9390            }
    9491        }
    95         if (args[i].equals("-endresults")) {
     92        else if (args[i].equals("-endresults")) {
    9693            i++;
    9794            if (args[i].matches("\\d+")) {
Note: See TracChangeset for help on using the changeset viewer.