[ 
http://issues.apache.org/jira/browse/NUTCH-204?page=comments#action_12367991 ] 

Stefan Groschupf commented on NUTCH-204:
----------------------------------------

Jérôme,
After taking a look to the HitDetails object again - after a some time - I 
notice I completely had overseen that there are already all values in key:value 
tuples in the HitDetais object. 
The problem is more that public String getValue(String field)  just returns the 
first field matching the field name. Accessing all values is already possible 
using  getLength, getField and getValue.
Isn't it?

>From my point of view should keep things as lightweight as possible and may 
>just  add one method getValues to the HitDetails object that could looks like 
>this:
public String[] getValues(String field) {
  ArrayList arrayList = new ArrayList();
  for (int i = 0; i < length; i++) {
    if (fields[i].equals(field))
      arrayList.addvalues[i]);
    }
  if(arrayList.size()>0){
    return (String[]) arrayList.toArray(new String[arrayList.size()]);
  }
  return null;
}
So I think introduce a new Property object, that needs to be instantiated  and 
serialized any time is just more overhead we should not introduce. 
HitDetails has influence of the search performance and with having one object 
instantiated more for each HitDetails we will slow down this by calling gc 
doubled often than before.
Would you agree just adding a method getValues to the HitDetails object?



> multiple field values in HitDetails
> -----------------------------------
>
>          Key: NUTCH-204
>          URL: http://issues.apache.org/jira/browse/NUTCH-204
>      Project: Nutch
>         Type: Improvement
>   Components: searcher
>     Versions: 0.8-dev
>     Reporter: Stefan Groschupf
>      Fix For: 0.8-dev
>  Attachments: DetailGetValues070206.patch, NUTCH-204.jc.060227.patch
>
> Improvement as Howie Wang suggested.
> http://mail-archives.apache.org/mod_mbox/lucene-nutch-dev/200601.mbox/[EMAIL 
> PROTECTED]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to