You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Michael Wechner <mi...@wyona.com> on 2004/05/09 01:50:09 UTC

method for getting the field type

I think it would make sense to have a method

String getType() for  (or maybe additional short getType())

http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/document/Field.html

which would return something like

Text, UnIndexed, etc.

or am I overlooking something?

I have seen that toString() is delivering the type as part of the return 
value,
but I think it would make sense to get this information without string 
manipulation.

WDYT?

btw, the Javadoc of isTermVectorStored() has a typo: available instead 
avaliable, but maybe this has been fixed within the CVS already.

Thanks

Michi

-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com              http://cocoon.apache.org/lenya/
michael.wechner@wyona.com                        michi@apache.org


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


Re: method for getting the field type

Posted by Michael Wechner <mi...@wyona.com>.
Erik Hatcher wrote:

> On May 8, 2004, at 7:50 PM, Michael Wechner wrote:
>
>> which would return something like
>>
>> Text, UnIndexed, etc.
>>
>> or am I overlooking something?
>>
>> I have seen that toString() is delivering the type as part of the 
>> return value,
>> but I think it would make sense to get this information without 
>> string manipulation.
>>
>> WDYT?
>
>
> Just out of curiosity, what would you do with the type of the field?


I'll output the search results as XML (for Lenya) and would like to add 
the field type as attribute, e.g.

<results total-hits="1">
 <hits>
   <hit pos="1">
<fields>
<field>Unindexed<year:2004></field>
<year type="Unindexed">2004</year>
<field>Text<subtitle:Untertitel></field>
<subtitle type="Text">Untertitel</subtitle>
<field>Text<title:Dear Lenya></field>
<title type="Text">Dear Lenya</title>
<field>Keyword<modified:0du06ovtc></field>
<modified type="Keyword">0du06ovtc</modified>
<field>Unindexed<mime-type:null></field>
<mime-type type="Unindexed">null</mime-type>
<field>
Unindexed<url:/2004/05/08/al/kommentarDU04HGF8-12.nzzoml>
</field>
<url type="Unindexed">/2004/05/08/al/kommentarDU04HGF8-12.nzzoml</url>
</fields>
<score percent="22">0.21875</score>
<uri parent="/2004/05/08/al" filename="kommentarDU04HGF8-12.nzzoml" 
querystring="">/2004/05/08/al/kommentarDU04HGF8-12.nzzoml
</uri>
<title>Liebe Levi</title>
<mime-type>null</mime-type>
<excerpt>
Dear
<word>Lenya</word>
</excerpt>
</hit>
</hits>
<pages>
 <page start="1" end="1" type="current">
</page>
</pages>
</results>

> It's useful to me to have something tangible in mind.


sure. Depending on the field type the XSLT then can show it in various ways.
I'm currently extracting it via 
toString().substring(0,toString.indexOf("<")),
which doesn't really hurt, but still ;-)

>
>> btw, the Javadoc of isTermVectorStored() has a typo: available 
>> instead avaliable, but maybe this has been fixed within the CVS already.
>
>
> This has been corrected in the CVS version.

thanks


btw, the XML above grew on my own mindset. It would be cool to 
standardize it
across the various search engines.


Thanks

Michi

>
>     Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com              http://cocoon.apache.org/lenya/
michael.wechner@wyona.com                        michi@apache.org


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


Re: method for getting the field type

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 8, 2004, at 7:50 PM, Michael Wechner wrote:
> which would return something like
>
> Text, UnIndexed, etc.
>
> or am I overlooking something?
>
> I have seen that toString() is delivering the type as part of the 
> return value,
> but I think it would make sense to get this information without string 
> manipulation.
>
> WDYT?

Just out of curiosity, what would you do with the type of the field?  
It's useful to me to have something tangible in mind.

> btw, the Javadoc of isTermVectorStored() has a typo: available instead 
> avaliable, but maybe this has been fixed within the CVS already.

This has been corrected in the CVS version.

	Erik


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