- Timestamp:
- 2006-09-18T14:32:31+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java
r12656 r12770 44 44 { 45 45 if (args.length == 0) { 46 System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzz y] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]");46 System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzziness value] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]"); 47 47 return; 48 48 } … … 58 58 Sort sorter = new Sort(); 59 59 Filter filter = null; 60 boolean fuzzy = false;60 String fuzziness = null; 61 61 62 62 // Paging … … 86 86 default_conjuction_operator = args[i]; 87 87 } 88 if (args[i].equals("-fuzz y"))88 if (args[i].equals("-fuzziness")) 89 89 { 90 fuzzy = true; 90 i++; 91 fuzziness = args[i]; 91 92 } 92 93 if (args[i].equals("-startresults")) … … 133 134 query_including_stop_words = query_including_stop_words.rewrite(reader); 134 135 135 Query query = parseQuery(reader, query_parser, query_string, fuzz y);136 Query query = parseQuery(reader, query_parser, query_string, fuzziness); 136 137 query = query.rewrite(reader); 137 138 … … 271 272 272 273 273 private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, boolean fuzzy)274 private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, String fuzziness) 274 275 throws java.io.IOException, org.apache.lucene.queryParser.ParseException 275 276 { … … 304 305 // If this is a fuzzy search, then we need to add the fuzzy 305 306 // flag to each of the query terms 306 if (fuzz y&& query.toString().length() > 0)307 if (fuzziness != null && query.toString().length() > 0) 307 308 { 308 309 // Revert the query to a string … … 363 364 { 364 365 ///ystem.err.println("Yahoo! Found fuzzy term."); 365 mutable_query_string.insert(o, '~' );366 mutable_query_string.insert(o, '~' + fuzziness); 366 367 o++; 367 368 s = 0; // Reset … … 374 375 if (s == 3) 375 376 { 376 mutable_query_string.append('~' );377 mutable_query_string.append('~' + fuzziness); 377 378 } 378 379 // Reparse the query
Note:
See TracChangeset
for help on using the changeset viewer.