Changeset 1635 for trunk/gsdl


Ignore:
Timestamp:
2000-10-31T12:19:50+13:00 (24 years ago)
Author:
paynter
Message:

Read phrases in prefix/body/suffix form for formatted display.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/phind/client/ResultBox.java

    r1627 r1635  
    6767    Panel label;
    6868
    69   // The key identifying the phrase displayed, with its text and the
    70   // collection from which it is drawn
    71     String searchKey, searchPhrase;
    72     String searchCollection;
     69    // The key identifying the phrase displayed, with its text and the
     70    // collection from which it is drawn
     71    String searchKey, searchPhrase, searchCollection;
    7372   
    74   // The total frequency, expansion frequency, and document frequency
    75   // of the phrase
    76   int numberOfOccurances;
     73    // The total frequency, expansion frequency, and document frequency
     74    // of the phrase
     75    int numberOfOccurances;
    7776    int numberOfExpansions;
    7877    int numberOfDocuments;
    7978
    80   // The number of phrases and documents retrieved, and the number of
    81   // times the user has requested more phrases or documents.
    82   int documentsRetrieved;
    83   int expansionsRetrieved;
     79    // The number of phrases and documents retrieved, and the number of
     80    // times the user has requested more phrases or documents.
     81    int documentsRetrieved;
     82    int expansionsRetrieved;
    8483    int nextPhraseBlock;
    8584    int nextDocumentBlock;
     
    318317    // System.out.println( "addExpansionListTag: " + line);
    319318
    320     String idStr = "", tfStr = "", efStr = "", dfStr = "";
     319    String idStr = "", text = "", tfStr = "", efStr = "", dfStr = "";
    321320    int tf = 0, ef = 0, df = 0;
    322321
     
    351350        }
    352351
     352        // Read the text of the phrase
     353        else if (line.startsWith("text")) {
     354        line = line.substring(6);
     355        nextSplit = line.indexOf((int) '"');
     356        if (nextSplit >= 1) {
     357            text = line.substring(0, nextSplit);
     358            line = line.substring(nextSplit + 1);
     359        } else {
     360            System.err.println("addExpansionListTag: error parsing: " + line);
     361        }
     362        }
     363
    353364        // Read the expansion frequency
    354365        else if (line.startsWith("ef")) {
     
    390401    // Add the data to the ResultBox
    391402    searchKey = idStr;
     403    searchPhrase = text;
    392404    numberOfOccurances = tf;
    393405    numberOfExpansions = ef;
     
    410422    // System.out.println( "addExpansionTag: " + line + " (" + expansionsRetrieved + ")");
    411423
    412     String numStr = "", idStr = "", tfStr = "", dfStr = "", body = "";
     424    String numStr = "", idStr = "", tfStr = "", dfStr = "",
     425        prefix = "", body = "", suffix = "";
     426
     427    body = searchPhrase;
    413428
    414429    // Break the tag down into its component parts
     
    442457        }
    443458
     459        // Read the prefix of the phrase
     460        else if (line.startsWith("prefix")) {
     461        line = line.substring(8);
     462        nextSplit = line.indexOf((int) '"');
     463        if (nextSplit >= 1) {
     464            prefix = line.substring(0, nextSplit);
     465            line = line.substring(nextSplit + 1);
     466        } else {
     467            System.err.println("ResultBox addExpansionTag: error parsing: " + line);
     468        }
     469        }
     470
     471        // Read the suffix of the phrase
     472        else if (line.startsWith("suffix")) {
     473        line = line.substring(8);
     474        nextSplit = line.indexOf((int) '"');
     475        if (nextSplit >= 1) {
     476            suffix = line.substring(0, nextSplit);
     477            line = line.substring(nextSplit + 1);
     478        } else {
     479            System.err.println("ResultBox addExpansionTag: error parsing: " + line);
     480        }
     481        }
     482
    444483        // Read the text of the phrase
    445         else if (line.startsWith("text")) {
    446         line = line.substring(6);
    447         nextSplit = line.indexOf((int) '"');
    448         if (nextSplit >= 1) {
    449             body = line.substring(0, nextSplit);
    450             line = line.substring(nextSplit + 1);
    451         } else {
    452             System.err.println("ResultBox addExpansionTag: error parsing: " + line);
    453         }
    454         }
     484        //      else if (line.startsWith("text")) {
     485        //line = line.substring(6);
     486        //nextSplit = line.indexOf((int) '"');
     487        //if (nextSplit >= 1) {
     488        //    body = line.substring(0, nextSplit);
     489        //    line = line.substring(nextSplit + 1);
     490        //} else {
     491        //    System.err.println("ResultBox addExpansionTag: error parsing: " + line);
     492        //}
     493        //}
    455494
    456495        // Read the frequency
     
    490529   
    491530    // Create a new ResultItem and add it to the display
    492     ResultItem ri = new ResultItem(idStr, tfStr, dfStr, "", body, "");
     531    ResultItem ri = new ResultItem(idStr, tfStr, dfStr, prefix, body, suffix);
    493532   
    494533    if (c.addResultItem(ri)) {
Note: See TracChangeset for help on using the changeset viewer.